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

Method TestStateCommand

core/integration/module_shell_test.go:633–653  ·  view source on GitHub ↗
(ctx context.Context, t *testctx.T)

Source from the content-addressed store, hash-verified

631}
632
633func (ShellSuite) TestStateCommand(ctx context.Context, t *testctx.T) {
634 setup := "FOO=$(directory | with-new-file foo bar); "
635
636 t.Run("state result", func(ctx context.Context, t *testctx.T) {
637 script := setup + "$FOO"
638
639 c := connect(ctx, t)
640 out, err := daggerCliBase(t, c).With(daggerShell(script)).Stdout(ctx)
641 require.NoError(t, err)
642 require.Regexp(t, `Directory@xxh3:[a-f0-9]{16}`, out)
643 })
644
645 t.Run("pipeline from state value", func(ctx context.Context, t *testctx.T) {
646 script := setup + "$FOO | file foo | contents"
647
648 c := connect(ctx, t)
649 out, err := daggerCliBase(t, c).With(daggerShell(script)).Stdout(ctx)
650 require.NoError(t, err)
651 require.Equal(t, "bar", out)
652 })
653}
654
655func (ShellSuite) TestStateInVarUsage(ctx context.Context, t *testctx.T) {
656 script := `

Callers

nothing calls this directly

Calls 7

daggerCliBaseFunction · 0.85
daggerShellFunction · 0.85
connectFunction · 0.70
RunMethod · 0.65
EqualMethod · 0.65
StdoutMethod · 0.45
WithMethod · 0.45

Tested by

no test coverage detected