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

Method TestNoLoadModule

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

Source from the content-addressed store, hash-verified

410}
411
412func (ShellSuite) TestNoLoadModule(ctx context.Context, t *testctx.T) {
413 t.Run("sanity check", func(ctx context.Context, t *testctx.T) {
414 c := connect(ctx, t)
415 out, err := modInit(t, c, "go", "").
416 With(daggerShell(".help")).
417 Stdout(ctx)
418 require.NoError(t, err)
419 require.Contains(t, out, "container-echo")
420 })
421
422 t.Run("forced no load", func(ctx context.Context, t *testctx.T) {
423 c := connect(ctx, t)
424 out, err := modInit(t, c, "go", "").
425 With(daggerShellNoMod(".help")).
426 Stdout(ctx)
427 require.NoError(t, err)
428 require.NotContains(t, out, "container-echo")
429 })
430
431 t.Run("dynamically loaded", func(ctx context.Context, t *testctx.T) {
432 c := connect(ctx, t)
433 out, err := modInit(t, c, "go", "").
434 With(daggerShellNoMod(".cd .; .help")).
435 Stdout(ctx)
436 require.NoError(t, err)
437 require.Contains(t, out, "container-echo")
438 })
439
440 t.Run("stateless load", func(ctx context.Context, t *testctx.T) {
441 c := connect(ctx, t)
442 out, err := modInit(t, c, "go", "").
443 With(daggerShellNoMod(". | .help container-echo")).
444 Stdout(ctx)
445 require.NoError(t, err)
446 require.Contains(t, out, "echoes whatever string argument")
447 })
448
449 t.Run("stateless .help load", func(ctx context.Context, t *testctx.T) {
450 c := connect(ctx, t)
451 out, err := modInit(t, c, "go", "").
452 With(daggerShellNoMod(".help .")).
453 Stdout(ctx)
454 require.NoError(t, err)
455 require.Contains(t, out, "MODULE")
456 require.Contains(t, out, "A generated module for Test functions")
457 })
458}
459
460func (ShellSuite) TestLoadAnotherModule(ctx context.Context, t *testctx.T) {
461 test := `package main

Callers

nothing calls this directly

Calls 8

modInitFunction · 0.85
daggerShellFunction · 0.85
daggerShellNoModFunction · 0.85
connectFunction · 0.70
RunMethod · 0.65
ContainsMethod · 0.65
StdoutMethod · 0.45
WithMethod · 0.45

Tested by

no test coverage detected