@@ -56,4 +56,16 @@ setup() {
|
||||
run "$DAGGER" --europa up ./plan/inputs/directories/conflicting_values.cue
|
||||
assert_failure
|
||||
assert_output --partial 'failed to up environment: actions.verify.contents: conflicting values "local directory" and "local dfsadf"'
|
||||
}
|
||||
}
|
||||
|
||||
@test "plan/inputs/secrets exec" {
|
||||
cd "$TESTDIR"
|
||||
"$DAGGER" --europa up ./plan/inputs/secrets/exec.cue
|
||||
}
|
||||
|
||||
@test "plan/inputs/secrets invalid command" {
|
||||
cd "$TESTDIR"
|
||||
run "$DAGGER" --europa up ./plan/inputs/secrets/invalid_command.cue
|
||||
assert_failure
|
||||
assert_output --partial 'failed: exec: "rtyet": executable file not found in $PATH'
|
||||
}
|
||||
|
34
tests/plan/inputs/secrets/exec.cue
Normal file
34
tests/plan/inputs/secrets/exec.cue
Normal file
@@ -0,0 +1,34 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/europa/dagger/engine"
|
||||
)
|
||||
|
||||
engine.#Plan & {
|
||||
inputs: secrets: echo: command: {
|
||||
name: "echo"
|
||||
args: ["hello europa"]
|
||||
}
|
||||
|
||||
actions: {
|
||||
|
||||
image: engine.#Pull & {
|
||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||
}
|
||||
|
||||
verify: engine.#Exec & {
|
||||
input: image.output
|
||||
mounts: secret: {
|
||||
dest: "/run/secrets/test"
|
||||
contents: inputs.secrets.echo.contents
|
||||
}
|
||||
args: [
|
||||
"sh", "-c",
|
||||
#"""
|
||||
test "$(cat /run/secrets/test)" = "hello europa"
|
||||
ls -l /run/secrets/test | grep -- "-r--------"
|
||||
"""#,
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
34
tests/plan/inputs/secrets/invalid_command.cue
Normal file
34
tests/plan/inputs/secrets/invalid_command.cue
Normal file
@@ -0,0 +1,34 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/europa/dagger/engine"
|
||||
)
|
||||
|
||||
engine.#Plan & {
|
||||
inputs: secrets: echo: command: {
|
||||
name: "rtyet" // should fail because command doesnt exist
|
||||
args: ["hello europa"]
|
||||
}
|
||||
|
||||
actions: {
|
||||
|
||||
image: engine.#Pull & {
|
||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||
}
|
||||
|
||||
verify: engine.#Exec & {
|
||||
input: image.output
|
||||
mounts: secret: {
|
||||
dest: "/run/secrets/test"
|
||||
contents: inputs.secrets.echo.contents
|
||||
}
|
||||
args: [
|
||||
"sh", "-c",
|
||||
#"""
|
||||
test "$(cat /run/secrets/test)" = "hello europa"
|
||||
ls -l /run/secrets/test | grep -- "-r--------"
|
||||
"""#,
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user