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

Method TestBlueprint

core/integration/workspace_test.go:77–100  ·  view source on GitHub ↗

TestWorkspaceBlueprint verifies that a blueprint module accepting a Workspace argument can access the host filesystem, just like a toolchain module.

(ctx context.Context, t *testctx.T)

Source from the content-addressed store, hash-verified

75// TestWorkspaceBlueprint verifies that a blueprint module accepting a Workspace
76// argument can access the host filesystem, just like a toolchain module.
77func (WorkspaceSuite) TestBlueprint(ctx context.Context, t *testctx.T) {
78 c := connect(ctx, t)
79
80 ctr := workspaceBase(t, c).
81 WithNewFile("hello.txt", "hello from workspace").
82 With(initDangBlueprint("greeter", `
83type Greeter {
84 pub source: Directory!
85
86 new(source: Workspace!) {
87 self.source = source.directory(".")
88 self
89 }
90
91 pub read: String! {
92 source.file("hello.txt").contents
93 }
94}
95`))
96
97 out, err := ctr.With(daggerCall("read")).Stdout(ctx)
98 require.NoError(t, err)
99 require.Equal(t, "hello from workspace", strings.TrimSpace(out))
100}
101
102// TestWorkspaceFindUp verifies that Workspace.findUp searches up from the
103// start path and stops at the workspace boundary.

Callers

nothing calls this directly

Calls 8

workspaceBaseFunction · 0.85
initDangBlueprintFunction · 0.85
daggerCallFunction · 0.85
connectFunction · 0.70
EqualMethod · 0.65
WithMethod · 0.45
WithNewFileMethod · 0.45
StdoutMethod · 0.45

Tested by

no test coverage detected