Add tests for Subdir operation

Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
This commit is contained in:
Tom Chauveau 2021-04-24 19:32:02 +02:00
parent 907430d409
commit 57256eb8c4
3 changed files with 35 additions and 1 deletions

View File

@ -207,6 +207,9 @@ setup() {
run "$DAGGER" compute "$TESTDIR"/ops/subdir/simple run "$DAGGER" compute "$TESTDIR"/ops/subdir/simple
assert_success assert_success
assert_line '{"hello":"world"}' assert_line '{"hello":"world"}'
run "$DAGGER" compute "$TESTDIR"/ops/subdir/error
assert_failure
} }
@test "op.#DockerBuild" { @test "op.#DockerBuild" {

View File

@ -0,0 +1,31 @@
package main
import "dagger.io/dagger/op"
hello: {
string
#up: [
op.#FetchContainer & {
ref: "alpine"
},
op.#Exec & {
args: ["mkdir", "-p", "/tmp/foo"]
},
op.#Exec & {
args: ["sh", "-c", "echo -n world > /tmp/foo/hello"]
},
op.#Subdir & {
dir: "/tmp/foo"
},
// Should FAIL
op.#Exec & {
always: true
args: ["ls"]
},
op.#Export & {
source: "./hello"
format: "string"
},
]
}

View File

@ -19,7 +19,7 @@ hello: {
dir: "/tmp/foo" dir: "/tmp/foo"
}, },
op.#Export & { op.#Export & {
source: "/hello" source: "./hello"
format: "string" format: "string"
}, },
] ]