Add do tests

Signed-off-by: Joel Longtine <joel@dagger.io>
This commit is contained in:
Joel Longtine
2022-03-07 16:53:50 -07:00
parent 2a6962ddc8
commit 5afaedc9ab
4 changed files with 196 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
package main
import (
"dagger.io/dagger"
"universe.dagger.io/alpine"
"universe.dagger.io/bash"
)
dagger.#Plan & {
outputs: files: andrea: {
dest: "./andrea_do"
contents: actions.test.b.y.export.files["/output.txt"]
}
actions: {
image: alpine.#Build & {
packages: bash: {}
}
test: {
a: bash.#Run & {
input: image.output
script: contents: "echo -n 'from andrea with love' > /output.txt"
export: files: "/output.txt": string
}
b: {
x: bash.#Run & {
input: image.output
script: contents: "echo -n testing > /output.txt"
export: files: "/output.txt": string
}
// This fails. Building the Actions lookup table breaks
if x.export.files["/output.txt"] == "testing" {
y: bash.#Run & {
input: a.output
script: contents: "echo -n hello from y"
export: files: "/output.txt": string
}
}
}
}
// notMe: bash.#Run & {
// input: image.output
// script: contents: "false"
// }
}
}