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

Method TestRefIntegration

core/integration/ref_test.go:11–41  ·  view source on GitHub ↗
(ctx context.Context, t *testctx.T)

Source from the content-addressed store, hash-verified

9)
10
11func (ModuleSuite) TestRefIntegration(ctx context.Context, t *testctx.T) {
12 c := connect(ctx, t)
13
14 // This test handles a very edgy case:
15 // goGitBase inits a /work directory with a git context
16 // we then create a local dir with the same structure as a git remote: `/work/github.com/dagger/dagger`
17 // It should be resolved as a local ref, not a remote one
18 t.Run("local module with same format as remote: github.com/dagger/dagger", func(ctx context.Context, t *testctx.T) {
19 out, err := goGitBase(t, c).
20 WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
21 WithWorkdir("/work/github.com/dagger/dagger").
22 WithExec([]string{"pwd"}).
23 With(daggerExec("init", "--source=.", "--name=dep", "--sdk=go")).
24 WithNewFile("/work/github.com/dagger/dagger/main.go", `package main
25
26 import "context"
27
28 type Dep struct {}
29
30 func (m *Dep) GetSource(ctx context.Context) string {
31 return "hello"
32 }
33 `,
34 ).
35 WithWorkdir("/work").
36 With(daggerCallAt("github.com/dagger/dagger", "get-source")).
37 Stdout(ctx)
38 require.NoError(t, err)
39 require.Equal(t, "hello", strings.TrimSpace(out))
40 })
41}

Callers

nothing calls this directly

Calls 13

goGitBaseFunction · 0.85
daggerCliFileFunction · 0.85
daggerExecFunction · 0.85
daggerCallAtFunction · 0.85
connectFunction · 0.70
RunMethod · 0.65
EqualMethod · 0.65
StdoutMethod · 0.45
WithMethod · 0.45
WithWorkdirMethod · 0.45
WithNewFileMethod · 0.45
WithExecMethod · 0.45

Tested by

no test coverage detected