diff --git a/tests/plan.bats b/tests/plan.bats index 2dde8f75..262850d5 100644 --- a/tests/plan.bats +++ b/tests/plan.bats @@ -94,19 +94,21 @@ setup() { } @test "plan/outputs/directories" { - cd "$TESTDIR"/plan/outputs/directories + cd "$TESTDIR"/plan/outputs/directories - rm -f "./out/test" - "$DAGGER" up ./outputs.cue - assert [ -f "./out/test" ] + "$DAGGER" up ./outputs.cue + assert [ -f "./out/test_outputs" ] + + rm -f "./out/test_outputs" } @test "plan/outputs/directories relative paths" { - cd "$TESTDIR"/plan + cd "$TESTDIR"/plan - rm -f "./outputs/directories/out/test" - "$DAGGER" up ./outputs/directories/outputs.cue - assert [ -f "./outputs/directories/out/test" ] + "$DAGGER" up ./outputs/directories/relative.cue + assert [ -f "./outputs/directories/out/test_relative" ] + + rm -f "./outputs/directories/out/test_relative" } @test "plan/outputs/files normal usage" { @@ -114,22 +116,22 @@ setup() { "$DAGGER" up ./usage.cue - run ./test.sh + run ./test_usage assert_output "Hello World!" - run ls -l "./test.sh" + run ls -l "./test_usage" assert_output --partial "-rwxr-x---" - rm -f "./test.sh" + rm -f "./test_usage" } @test "plan/outputs/files relative path" { - cd "$TESTDIR"/plan + cd "$TESTDIR"/plan - "$DAGGER" up ./outputs/files/usage.cue - assert [ -f "./outputs/files/test.sh" ] + "$DAGGER" up ./outputs/files/relative.cue + assert [ -f "./outputs/files/test_relative" ] - rm -f "./outputs/files/test.sh" + rm -f "./outputs/files/test_relative" } @test "plan/outputs/files default permissions" { @@ -137,10 +139,10 @@ setup() { "$DAGGER" up ./default_permissions.cue - run ls -l "./test" + run ls -l "./test_default_permissions" assert_output --partial "-rw-r--r--" - rm -f "./test" + rm -f "./test_default_permissions" } @test "plan/outputs/files no contents" { @@ -150,7 +152,9 @@ setup() { assert_failure assert_output --partial "contents is not set" - assert [ ! -f "./test" ] + assert [ ! -f "./test_no_contents" ] + + rm -f "./test_no_contents" } @test "plan/platform" { diff --git a/tests/plan/outputs/directories/outputs.cue b/tests/plan/outputs/directories/outputs.cue index a46ceaf7..0b3a2041 100644 --- a/tests/plan/outputs/directories/outputs.cue +++ b/tests/plan/outputs/directories/outputs.cue @@ -7,12 +7,12 @@ import ( dagger.#Plan & { actions: data: dagger.#WriteFile & { input: dagger.#Scratch - path: "/test" + path: "/test_outputs" permissions: 0o600 contents: "foobar" } - outputs: directories: test: { + outputs: directories: test_outputs: { contents: actions.data.output dest: "./out" } diff --git a/tests/plan/outputs/directories/relative.cue b/tests/plan/outputs/directories/relative.cue new file mode 100644 index 00000000..9b626b6d --- /dev/null +++ b/tests/plan/outputs/directories/relative.cue @@ -0,0 +1,19 @@ +package main + +import ( + "dagger.io/dagger" +) + +dagger.#Plan & { + actions: data: dagger.#WriteFile & { + input: dagger.#Scratch + path: "/test_relative" + permissions: 0o600 + contents: "foobar" + } + + outputs: directories: test_relative: { + contents: actions.data.output + dest: "./out" + } +} diff --git a/tests/plan/outputs/files/default_permissions.cue b/tests/plan/outputs/files/default_permissions.cue index 3dceba5e..fc4c6cc1 100644 --- a/tests/plan/outputs/files/default_permissions.cue +++ b/tests/plan/outputs/files/default_permissions.cue @@ -5,6 +5,6 @@ import "dagger.io/dagger" dagger.#Plan & { outputs: files: test: { contents: "foobar" - dest: "./test" + dest: "./test_default_permissions" } } diff --git a/tests/plan/outputs/files/no_contents.cue b/tests/plan/outputs/files/no_contents.cue index c7fc9d55..92a6c74f 100644 --- a/tests/plan/outputs/files/no_contents.cue +++ b/tests/plan/outputs/files/no_contents.cue @@ -3,5 +3,5 @@ package main import "dagger.io/dagger" dagger.#Plan & { - outputs: files: test: dest: "./test" + outputs: files: test: dest: "./test_no_contents" } diff --git a/tests/plan/outputs/files/relative.cue b/tests/plan/outputs/files/relative.cue new file mode 100644 index 00000000..72668198 --- /dev/null +++ b/tests/plan/outputs/files/relative.cue @@ -0,0 +1,15 @@ +package main + +import "dagger.io/dagger" + +dagger.#Plan & { + outputs: files: { + [path=string]: dest: path + test_relative: contents: """ + #!/bin/bash + set -euo pipefail + echo "Hello World!" + + """ + } +} diff --git a/tests/plan/outputs/files/usage.cue b/tests/plan/outputs/files/usage.cue index ac2bdd11..8633db62 100644 --- a/tests/plan/outputs/files/usage.cue +++ b/tests/plan/outputs/files/usage.cue @@ -5,7 +5,7 @@ import "dagger.io/dagger" dagger.#Plan & { outputs: files: { [path=string]: dest: path - "test.sh": { + test_usage: { contents: """ #!/bin/bash set -euo pipefail