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

Method TestContextDirectory

core/integration/module_test.go:3984–4920  ·  view source on GitHub ↗
(ctx context.Context, t *testctx.T)

Source from the content-addressed store, hash-verified

3982}
3983
3984func (ModuleSuite) TestContextDirectory(ctx context.Context, t *testctx.T) {
3985 type testCase struct {
3986 sdk string
3987 source string
3988 }
3989
3990 t.Run("load context inside git repo with module in a sub dir", func(ctx context.Context, t *testctx.T) {
3991 for _, tc := range []testCase{
3992 {
3993 sdk: "go",
3994 source: `package main
3995
3996import (
3997 "context"
3998 "dagger/test/internal/dagger"
3999)
4000
4001type Test struct {}
4002
4003func (t *Test) Dirs(
4004 ctx context.Context,
4005
4006 // +defaultPath="/"
4007 root *dagger.Directory,
4008
4009 // +defaultPath="."
4010 relativeRoot *dagger.Directory,
4011) ([]string, error) {
4012 res, err := root.Entries(ctx)
4013 if err != nil {
4014 return nil, err
4015 }
4016 relativeRes, err := relativeRoot.Entries(ctx)
4017 if err != nil {
4018 return nil, err
4019 }
4020 return append(res, relativeRes...), nil
4021}
4022
4023
4024func (t *Test) DirsIgnore(
4025 ctx context.Context,
4026
4027 // +defaultPath="/"
4028 // +ignore=["**", "!backend", "!frontend"]
4029 root *dagger.Directory,
4030
4031 // +defaultPath="."
4032 // +ignore=["dagger.json", "LICENSE"]
4033 relativeRoot *dagger.Directory,
4034) ([]string, error) {
4035 res, err := root.Entries(ctx)
4036 if err != nil {
4037 return nil, err
4038 }
4039 relativeRes, err := relativeRoot.Entries(ctx)
4040 if err != nil {
4041 return nil, err

Callers

nothing calls this directly

Calls 15

goGitBaseFunction · 0.85
daggerCliFileFunction · 0.85
daggerExecFunction · 0.85
sdkSourceFunction · 0.85
daggerCallAtFunction · 0.85
daggerCallFunction · 0.85
requireErrOutFunction · 0.85
connectFunction · 0.70
RunMethod · 0.65
DirectoryMethod · 0.65
EqualMethod · 0.65
WithWorkdirMethod · 0.45

Tested by

no test coverage detected