(ctx context.Context, t *testctx.T)
| 9 | ) |
| 10 | |
| 11 | func (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 | } |
nothing calls this directly
no test coverage detected