MCPcopy Create free account
hub / github.com/dagger/dagger / TestDirectorySourcePath

Method TestDirectorySourcePath

core/integration/container_test.go:2447–2530  ·  view source on GitHub ↗
(ctx context.Context, t *testctx.T)

Source from the content-addressed store, hash-verified

2445}
2446
2447func (ContainerSuite) TestDirectorySourcePath(ctx context.Context, t *testctx.T) {
2448 c := connect(ctx, t)
2449 dirRes, err := testutil.QueryWithClient[struct {
2450 Directory struct {
2451 WithNewFile struct {
2452 Directory struct {
2453 ID core.DirectoryID
2454 }
2455 }
2456 }
2457 }](c, t,
2458 `{
2459 directory {
2460 withNewFile(path: "some-dir/sub-dir/sub-file", contents: "sub-content\n") {
2461 directory(path: "some-dir") {
2462 id
2463 }
2464 }
2465 }
2466 }`, nil)
2467 require.NoError(t, err)
2468
2469 id := dirRes.Directory.WithNewFile.Directory.ID
2470
2471 writeRes, err := testutil.QueryWithClient[struct {
2472 Container struct {
2473 From struct {
2474 WithMountedDirectory struct {
2475 WithExec struct {
2476 Directory struct {
2477 ID core.DirectoryID
2478 }
2479 }
2480 }
2481 }
2482 }
2483 }](c, t,
2484 `query Test($id: ID!) {
2485 container {
2486 from(address: "`+alpineImage+`") {
2487 withMountedDirectory(path: "/mnt/dir", source: $id) {
2488 withExec(args: ["sh", "-c", "echo more-content >> /mnt/dir/sub-dir/sub-file"]) {
2489 directory(path: "/mnt/dir/sub-dir") {
2490 id
2491 }
2492 }
2493 }
2494 }
2495 }
2496 }`, &testutil.QueryOptions{Variables: map[string]any{
2497 "id": id,
2498 }})
2499 require.NoError(t, err)
2500
2501 writtenID := writeRes.Container.From.WithMountedDirectory.WithExec.Directory.ID
2502
2503 execRes, err := testutil.QueryWithClient[struct {
2504 Container struct {

Callers

nothing calls this directly

Calls 3

QueryWithClientFunction · 0.92
connectFunction · 0.70
EqualMethod · 0.65

Tested by

no test coverage detected