From 8bb2cfbb21bfa48f48825e3244c796f9e5c93fea Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Fri, 2 Apr 2021 13:55:01 -0700 Subject: [PATCH 01/11] test: added cli test for new --plan-git Signed-off-by: Sam Alba --- tests/test-cli.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test-cli.sh b/tests/test-cli.sh index af8a011e..22fa040e 100644 --- a/tests/test-cli.sh +++ b/tests/test-cli.sh @@ -9,6 +9,7 @@ test::cli() { test::cli::list "$dagger" test::cli::newdir "$dagger" + test::cli::newgit "$dagger" test::cli::query "$dagger" } @@ -54,6 +55,27 @@ test::cli::newdir() { "$dagger" "${DAGGER_BINARY_ARGS[@]}" query -f cue -d "simple" -c } +test::cli::newgit() { + local dagger="$1" + + # Create temporary store + local DAGGER_STORE + DAGGER_STORE="$(mktemp -d -t dagger-store-XXXXXX)" + export DAGGER_STORE + + test::one "CLI: new: --plan-git" \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" new --plan-git https://github.com/samalba/dagger-test.git simple + + test::one "CLI: new: verify plan can be upped" \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" up -d "simple" + + test::one "CLI: new: verify we have the right plan" --stdout='{ + foo: "value" + bar: "another value" +}' \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" query -d "simple" -c +} + test::cli::query() { local dagger="$1" From f5afb97d03040a16884c91f8869d896f653a8160 Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Fri, 2 Apr 2021 15:02:14 -0700 Subject: [PATCH 02/11] test: implemented cli test for plan * Signed-off-by: Sam Alba --- tests/test-cli.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/test-cli.sh b/tests/test-cli.sh index 22fa040e..31b750fb 100644 --- a/tests/test-cli.sh +++ b/tests/test-cli.sh @@ -11,6 +11,7 @@ test::cli() { test::cli::newdir "$dagger" test::cli::newgit "$dagger" test::cli::query "$dagger" + test::cli::plan "$dagger" } test::cli::list() { @@ -102,3 +103,30 @@ test::cli::query() { test::one "CLI: query: non concrete" --exit=1 \ "$dagger" "${DAGGER_BINARY_ARGS[@]}" query -f cue -d "nonconcrete" -c } + +test::cli::plan() { + local dagger="$1" + + # Create temporary store + local DAGGER_STORE + DAGGER_STORE="$(mktemp -d -t dagger-store-XXXXXX)" + export DAGGER_STORE + + test::one "CLI: new" \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" new --plan-dir "$d"/cli/simple simple + + test::one "CLI: plan dir" \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" -d "simple" plan dir "$d"/cli/nonconcrete + + test::one "CLI: plan dir: query non-concrete" --exit=1 \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" -d "simple" query -c + + test::one "CLI: plan git" \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" -d "simple" plan git https://github.com/samalba/dagger-test.git + + test::one "CLI: plan git: verify we have the right plan" --stdout='{ + foo: "value" + bar: "another value" +}' \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" query -d "simple" -c +} From a24dbef0b7ad7d88b01f87be167fc25a0f8c9faa Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Fri, 2 Apr 2021 16:21:54 -0700 Subject: [PATCH 03/11] cli: up: restored result display Signed-off-by: Sam Alba --- cmd/dagger/cmd/up.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/dagger/cmd/up.go b/cmd/dagger/cmd/up.go index e935a5c7..8d75cc9f 100644 --- a/cmd/dagger/cmd/up.go +++ b/cmd/dagger/cmd/up.go @@ -31,7 +31,7 @@ var upCmd = &cobra.Command{ state := common.GetCurrentDeploymentState(ctx, store) // TODO: Implement options: --no-cache - common.DeploymentUp(ctx, state, false) + common.DeploymentUp(ctx, state, true) }, } From d3fc31ab57a51b6605c07a6e9c66ea6567788459 Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Fri, 2 Apr 2021 16:29:34 -0700 Subject: [PATCH 04/11] fixed inputs when input target is overriden Signed-off-by: Sam Alba --- cmd/dagger/cmd/compute.go | 10 +++++----- cmd/dagger/cmd/input/root.go | 2 +- dagger/deployment.go | 10 +++++++++- dagger/input_test.go | 2 +- dagger/store_test.go | 4 ++-- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/cmd/dagger/cmd/compute.go b/cmd/dagger/cmd/compute.go index 4151dc5e..033e5f38 100644 --- a/cmd/dagger/cmd/compute.go +++ b/cmd/dagger/cmd/compute.go @@ -41,7 +41,7 @@ var computeCmd = &cobra.Command{ for _, input := range viper.GetStringSlice("input-string") { parts := strings.SplitN(input, "=", 2) k, v := parts[0], parts[1] - err := st.AddInput(k, dagger.TextInput(v)) + err := st.SetInput(k, dagger.TextInput(v)) if err != nil { lg. Fatal(). @@ -54,7 +54,7 @@ var computeCmd = &cobra.Command{ for _, input := range viper.GetStringSlice("input-dir") { parts := strings.SplitN(input, "=", 2) k, v := parts[0], parts[1] - err := st.AddInput(k, dagger.DirInput(v, []string{})) + err := st.SetInput(k, dagger.DirInput(v, []string{})) if err != nil { lg. Fatal(). @@ -67,7 +67,7 @@ var computeCmd = &cobra.Command{ for _, input := range viper.GetStringSlice("input-git") { parts := strings.SplitN(input, "=", 2) k, v := parts[0], parts[1] - err := st.AddInput(k, dagger.GitInput(v, "", "")) + err := st.SetInput(k, dagger.GitInput(v, "", "")) if err != nil { lg. Fatal(). @@ -98,7 +98,7 @@ var computeCmd = &cobra.Command{ lg.Fatal().Msg("invalid json") } - err = st.AddInput("", dagger.JSONInput(string(content))) + err = st.SetInput("", dagger.JSONInput(string(content))) if err != nil { lg.Fatal().Err(err).Msg("failed to add input") } @@ -121,7 +121,7 @@ var computeCmd = &cobra.Command{ content = plaintext } - err = st.AddInput("", dagger.YAMLInput(string(content))) + err = st.SetInput("", dagger.YAMLInput(string(content))) if err != nil { lg.Fatal().Err(err).Msg("failed to add input") } diff --git a/cmd/dagger/cmd/input/root.go b/cmd/dagger/cmd/input/root.go index 57dd9500..d212ab67 100644 --- a/cmd/dagger/cmd/input/root.go +++ b/cmd/dagger/cmd/input/root.go @@ -34,7 +34,7 @@ func updateDeploymentInput(ctx context.Context, target string, input dagger.Inpu } st := common.GetCurrentDeploymentState(ctx, store) - st.AddInput(target, input) + st.SetInput(target, input) if err := store.UpdateDeployment(ctx, st, nil); err != nil { lg.Fatal().Err(err).Str("deploymentId", st.ID).Str("deploymentName", st.Name).Msg("cannot update deployment") diff --git a/dagger/deployment.go b/dagger/deployment.go index c4b6a64a..5dfd5dbd 100644 --- a/dagger/deployment.go +++ b/dagger/deployment.go @@ -40,7 +40,15 @@ type inputKV struct { Value Input `json:"value,omitempty"` } -func (s *DeploymentState) AddInput(key string, value Input) error { +func (s *DeploymentState) SetInput(key string, value Input) error { + for i, inp := range s.Inputs { + if inp.Key != key { + continue + } + // Remove existing inputs with the same key + s.Inputs = append(s.Inputs[:i], s.Inputs[i+1:]...) + } + s.Inputs = append(s.Inputs, inputKV{Key: key, Value: value}) return nil } diff --git a/dagger/input_test.go b/dagger/input_test.go index c1089051..d3e65fcc 100644 --- a/dagger/input_test.go +++ b/dagger/input_test.go @@ -10,7 +10,7 @@ func TestInputDir(t *testing.T) { st := &DeploymentState{ PlanSource: DirInput("/tmp/source", []string{}), } - require.NoError(t, st.AddInput("www.source", DirInput(".", []string{}))) + require.NoError(t, st.SetInput("www.source", DirInput(".", []string{}))) deployment, err := NewDeployment(st) require.NoError(t, err) diff --git a/dagger/store_test.go b/dagger/store_test.go index abe7cf33..47449be8 100644 --- a/dagger/store_test.go +++ b/dagger/store_test.go @@ -62,7 +62,7 @@ func TestStoreLookupByPath(t *testing.T) { st := &DeploymentState{ Name: "test", } - require.NoError(t, st.AddInput("foo", DirInput("/test/path", []string{}))) + require.NoError(t, st.SetInput("foo", DirInput("/test/path", []string{}))) require.NoError(t, store.CreateDeployment(ctx, st)) // Lookup by path @@ -72,7 +72,7 @@ func TestStoreLookupByPath(t *testing.T) { require.Equal(t, st.ID, r.ID) // Add a new path - require.NoError(t, st.AddInput("bar", DirInput("/test/anotherpath", []string{}))) + require.NoError(t, st.SetInput("bar", DirInput("/test/anotherpath", []string{}))) require.NoError(t, store.UpdateDeployment(ctx, st, nil)) // Lookup by the previous path From b12a3bf45f5ed7ce841a02474cb4193affb1d00c Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Fri, 2 Apr 2021 16:40:41 -0700 Subject: [PATCH 05/11] test: implemented cli tests for input git,dir Signed-off-by: Sam Alba --- tests/cli/input/main.cue | 25 +++++++++++++++++++++++++ tests/cli/input/testdata/testfile | 1 + tests/test-cli.sh | 28 ++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 tests/cli/input/main.cue create mode 100644 tests/cli/input/testdata/testfile diff --git a/tests/cli/input/main.cue b/tests/cli/input/main.cue new file mode 100644 index 00000000..ee315aa6 --- /dev/null +++ b/tests/cli/input/main.cue @@ -0,0 +1,25 @@ +package testing + +import ( + "dagger.io/llb" + "dagger.io/dagger" +) + +source: dagger.#Artifact +foo: "bar" + +bar: { + string + + #compute: [ + llb.#FetchContainer & {ref: "busybox"}, + llb.#Exec & { + args: ["cp", "/source/testfile", "/out"], + mount: "/source": from: source + }, + llb.#Export & { + format: "string" + source: "/out" + } + ] +} diff --git a/tests/cli/input/testdata/testfile b/tests/cli/input/testdata/testfile new file mode 100644 index 00000000..20495ffb --- /dev/null +++ b/tests/cli/input/testdata/testfile @@ -0,0 +1 @@ +thisisatest diff --git a/tests/test-cli.sh b/tests/test-cli.sh index 31b750fb..ebb221f4 100644 --- a/tests/test-cli.sh +++ b/tests/test-cli.sh @@ -12,6 +12,7 @@ test::cli() { test::cli::newgit "$dagger" test::cli::query "$dagger" test::cli::plan "$dagger" + test::cli::input "$dagger" } test::cli::list() { @@ -130,3 +131,30 @@ test::cli::plan() { }' \ "$dagger" "${DAGGER_BINARY_ARGS[@]}" query -d "simple" -c } + +test::cli::input() { + local dagger="$1" + + # Create temporary store + local DAGGER_STORE + DAGGER_STORE="$(mktemp -d -t dagger-store-XXXXXX)" + export DAGGER_STORE + + test::one "CLI: new input" \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" new --plan-dir "$d"/cli/input "input" + + test::one "CLI: up: missing input" \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" up -d "input" --stdout='{"foo":"bar"}' + + test::one "CLI: plan dir" \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" input -d "input" dir "source" ./tests/cli/input/testdata + + test::one "CLI: up: input is set with input dir" \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" up -d "input" --stdout='{"bar":"thisisatest\n","foo":"bar","source":{}}' + + test::one "CLI: plan dir" \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" input -d "input" git "source" https://github.com/samalba/dagger-test-simple.git + + test::one "CLI: up: input is set with input git" \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" up -d "input" --stdout='{"bar":"testgit\n","foo":"bar","source":{}}' +} From 3e605d1d72a6ffbbbee58f652899fa314399234d Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Fri, 2 Apr 2021 16:41:26 -0700 Subject: [PATCH 06/11] cli: moved input dir to abs path - fixes #254 Signed-off-by: Sam Alba --- cmd/dagger/cmd/input/dir.go | 9 ++++++++- cmd/dagger/cmd/new.go | 7 ++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/cmd/dagger/cmd/input/dir.go b/cmd/dagger/cmd/input/dir.go index 0b0177cf..6e2c250b 100644 --- a/cmd/dagger/cmd/input/dir.go +++ b/cmd/dagger/cmd/input/dir.go @@ -1,6 +1,8 @@ package input import ( + "path/filepath" + "dagger.io/go/cmd/dagger/logger" "dagger.io/go/dagger" "github.com/spf13/cobra" @@ -22,7 +24,12 @@ var dirCmd = &cobra.Command{ lg := logger.New() ctx := lg.WithContext(cmd.Context()) - updateDeploymentInput(ctx, args[0], dagger.DirInput(args[1], []string{})) + path, err := filepath.Abs(args[1]) + if err != nil { + lg.Error().Err(err).Str("path", args[1]).Msg("cannot get absolute path") + } + + updateDeploymentInput(ctx, args[0], dagger.DirInput(path, []string{})) }, } diff --git a/cmd/dagger/cmd/new.go b/cmd/dagger/cmd/new.go index 764a933e..c20e9811 100644 --- a/cmd/dagger/cmd/new.go +++ b/cmd/dagger/cmd/new.go @@ -102,7 +102,12 @@ func getPlanSource(ctx context.Context) dagger.Input { if planDir != "" { checkFirstSet() - src = dagger.DirInput(planDir, []string{"*.cue", "cue.mod"}) + + path, err := filepath.Abs(planDir) + if err != nil { + lg.Error().Err(err).Str("path", planDir).Msg("cannot get absolute path") + } + src = dagger.DirInput(path, []string{"*.cue", "cue.mod"}) } if planGit != "" { From e6b0ca5109b320dad97a4fecfdca499720a5e5f5 Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Fri, 2 Apr 2021 16:46:41 -0700 Subject: [PATCH 07/11] cue fmt Signed-off-by: Sam Alba --- tests/cli/input/main.cue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/cli/input/main.cue b/tests/cli/input/main.cue index ee315aa6..636cf13a 100644 --- a/tests/cli/input/main.cue +++ b/tests/cli/input/main.cue @@ -6,7 +6,7 @@ import ( ) source: dagger.#Artifact -foo: "bar" +foo: "bar" bar: { string @@ -14,12 +14,12 @@ bar: { #compute: [ llb.#FetchContainer & {ref: "busybox"}, llb.#Exec & { - args: ["cp", "/source/testfile", "/out"], + args: ["cp", "/source/testfile", "/out"] mount: "/source": from: source }, llb.#Export & { format: "string" source: "/out" - } + }, ] } From a799dd05d7648077923811e787d38095abe42ac7 Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Fri, 2 Apr 2021 17:14:01 -0700 Subject: [PATCH 08/11] cli: moved abs path resolve to input.go Signed-off-by: Sam Alba --- cmd/dagger/cmd/input/dir.go | 9 +-------- cmd/dagger/cmd/new.go | 6 +----- dagger/input.go | 8 ++++++++ 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/cmd/dagger/cmd/input/dir.go b/cmd/dagger/cmd/input/dir.go index 6e2c250b..0b0177cf 100644 --- a/cmd/dagger/cmd/input/dir.go +++ b/cmd/dagger/cmd/input/dir.go @@ -1,8 +1,6 @@ package input import ( - "path/filepath" - "dagger.io/go/cmd/dagger/logger" "dagger.io/go/dagger" "github.com/spf13/cobra" @@ -24,12 +22,7 @@ var dirCmd = &cobra.Command{ lg := logger.New() ctx := lg.WithContext(cmd.Context()) - path, err := filepath.Abs(args[1]) - if err != nil { - lg.Error().Err(err).Str("path", args[1]).Msg("cannot get absolute path") - } - - updateDeploymentInput(ctx, args[0], dagger.DirInput(path, []string{})) + updateDeploymentInput(ctx, args[0], dagger.DirInput(args[1], []string{})) }, } diff --git a/cmd/dagger/cmd/new.go b/cmd/dagger/cmd/new.go index c20e9811..9c3e3966 100644 --- a/cmd/dagger/cmd/new.go +++ b/cmd/dagger/cmd/new.go @@ -103,11 +103,7 @@ func getPlanSource(ctx context.Context) dagger.Input { if planDir != "" { checkFirstSet() - path, err := filepath.Abs(planDir) - if err != nil { - lg.Error().Err(err).Str("path", planDir).Msg("cannot get absolute path") - } - src = dagger.DirInput(path, []string{"*.cue", "cue.mod"}) + src = dagger.DirInput(planDir, []string{"*.cue", "cue.mod"}) } if planGit != "" { diff --git a/dagger/input.go b/dagger/input.go index a00db28f..9a544bef 100644 --- a/dagger/input.go +++ b/dagger/input.go @@ -3,6 +3,7 @@ package dagger import ( "encoding/json" "fmt" + "path/filepath" "dagger.io/go/dagger/compiler" ) @@ -82,6 +83,13 @@ type dirInput struct { func (dir dirInput) Compile() (*compiler.Value, error) { // FIXME: serialize an intermediate struct, instead of generating cue source + // resolve absolute path + path, err := filepath.Abs(dir.Path) + if err != nil { + return nil, err + } + dir.Path = path + // json.Marshal([]string{}) returns []byte("null"), which wreaks havoc // in Cue because `null` is not a `[...string]` includeLLB := []byte("[]") From 21e0ac21de45b6984517e5c66eb6519be43040fe Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Fri, 2 Apr 2021 17:16:57 -0700 Subject: [PATCH 09/11] fixed tests Signed-off-by: Sam Alba --- tests/cli/input/main.cue | 2 +- tests/test-cli.sh | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/cli/input/main.cue b/tests/cli/input/main.cue index 636cf13a..fd0f7b94 100644 --- a/tests/cli/input/main.cue +++ b/tests/cli/input/main.cue @@ -11,7 +11,7 @@ foo: "bar" bar: { string - #compute: [ + #up: [ llb.#FetchContainer & {ref: "busybox"}, llb.#Exec & { args: ["cp", "/source/testfile", "/out"] diff --git a/tests/test-cli.sh b/tests/test-cli.sh index ebb221f4..276d50b1 100644 --- a/tests/test-cli.sh +++ b/tests/test-cli.sh @@ -65,17 +65,17 @@ test::cli::newgit() { DAGGER_STORE="$(mktemp -d -t dagger-store-XXXXXX)" export DAGGER_STORE - test::one "CLI: new: --plan-git" \ + test::one "CLI: new git: --plan-git" \ "$dagger" "${DAGGER_BINARY_ARGS[@]}" new --plan-git https://github.com/samalba/dagger-test.git simple - test::one "CLI: new: verify plan can be upped" \ + test::one "CLI: new git: verify plan can be upped" \ "$dagger" "${DAGGER_BINARY_ARGS[@]}" up -d "simple" - test::one "CLI: new: verify we have the right plan" --stdout='{ + test::one "CLI: new git: verify we have the right plan" --stdout='{ foo: "value" bar: "another value" }' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" query -d "simple" -c + "$dagger" "${DAGGER_BINARY_ARGS[@]}" query -f cue -d "simple" -c } test::cli::query() { @@ -129,7 +129,7 @@ test::cli::plan() { foo: "value" bar: "another value" }' \ - "$dagger" "${DAGGER_BINARY_ARGS[@]}" query -d "simple" -c + "$dagger" "${DAGGER_BINARY_ARGS[@]}" query -f cue -d "simple" -c } test::cli::input() { @@ -146,13 +146,13 @@ test::cli::input() { test::one "CLI: up: missing input" \ "$dagger" "${DAGGER_BINARY_ARGS[@]}" up -d "input" --stdout='{"foo":"bar"}' - test::one "CLI: plan dir" \ + test::one "CLI: input dir" \ "$dagger" "${DAGGER_BINARY_ARGS[@]}" input -d "input" dir "source" ./tests/cli/input/testdata test::one "CLI: up: input is set with input dir" \ "$dagger" "${DAGGER_BINARY_ARGS[@]}" up -d "input" --stdout='{"bar":"thisisatest\n","foo":"bar","source":{}}' - test::one "CLI: plan dir" \ + test::one "CLI: input git" \ "$dagger" "${DAGGER_BINARY_ARGS[@]}" input -d "input" git "source" https://github.com/samalba/dagger-test-simple.git test::one "CLI: up: input is set with input git" \ From ce6ce871ab087b3e96425eaed278402cd57e87c2 Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Fri, 2 Apr 2021 17:26:19 -0700 Subject: [PATCH 10/11] moved abs path to DirInput Signed-off-by: Sam Alba --- dagger/input.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/dagger/input.go b/dagger/input.go index 9a544bef..c27db8c4 100644 --- a/dagger/input.go +++ b/dagger/input.go @@ -66,6 +66,12 @@ func (i Input) Compile() (*compiler.Value, error) { // An input artifact loaded from a local directory func DirInput(path string, include []string) Input { + // resolve absolute path + path, err := filepath.Abs(path) + if err != nil { + panic(err) + } + return Input{ Type: InputTypeDir, Dir: &dirInput{ @@ -83,13 +89,6 @@ type dirInput struct { func (dir dirInput) Compile() (*compiler.Value, error) { // FIXME: serialize an intermediate struct, instead of generating cue source - // resolve absolute path - path, err := filepath.Abs(dir.Path) - if err != nil { - return nil, err - } - dir.Path = path - // json.Marshal([]string{}) returns []byte("null"), which wreaks havoc // in Cue because `null` is not a `[...string]` includeLLB := []byte("[]") From a79e13a35c11813810a7c7d3dea6b7af8a3a051f Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Fri, 2 Apr 2021 17:32:05 -0700 Subject: [PATCH 11/11] test: fixed input_test.go Signed-off-by: Sam Alba --- dagger/input_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dagger/input_test.go b/dagger/input_test.go index d3e65fcc..b959881d 100644 --- a/dagger/input_test.go +++ b/dagger/input_test.go @@ -10,13 +10,13 @@ func TestInputDir(t *testing.T) { st := &DeploymentState{ PlanSource: DirInput("/tmp/source", []string{}), } - require.NoError(t, st.SetInput("www.source", DirInput(".", []string{}))) + require.NoError(t, st.SetInput("www.source", DirInput("/", []string{}))) deployment, err := NewDeployment(st) require.NoError(t, err) localdirs := deployment.LocalDirs() require.Len(t, localdirs, 2) - require.Contains(t, localdirs, ".") + require.Contains(t, localdirs, "/") require.Contains(t, localdirs, "/tmp/source") }