fixed test, and added more failure modes
Signed-off-by: Richard Jones <richard@dagger.io>
This commit is contained in:
parent
e65b3cfa4a
commit
c422512155
@ -4,13 +4,37 @@ setup() {
|
|||||||
common_setup
|
common_setup
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "plan: hello" {
|
@test "plan/hello" {
|
||||||
# Europa loader handles the cwd differently, therefore we need to CD into the tree at or below the parent of cue.mod
|
# Europa loader handles the cwd differently, therefore we need to CD into the tree at or below the parent of cue.mod
|
||||||
cd "$TESTDIR"
|
cd "$TESTDIR"
|
||||||
"$DAGGER" --europa up ./plan/hello-europa
|
"$DAGGER" --europa up ./plan/hello-europa
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "plan: unix socket" {
|
@test "plan/context/services invalid schema" {
|
||||||
cd "$TESTDIR"
|
cd "$TESTDIR"
|
||||||
"$DAGGER" --europa up ./plan/context/services/unix
|
run "$DAGGER" --europa up ./plan/context/services/invalid_schema.cue
|
||||||
|
assert_failure
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "plan/context/services invalid value" {
|
||||||
|
cd "$TESTDIR"
|
||||||
|
run "$DAGGER" --europa up ./plan/context/services/invalid_value.cue
|
||||||
|
assert_failure
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "plan/context/services incomplete unix" {
|
||||||
|
cd "$TESTDIR"
|
||||||
|
run "$DAGGER" --europa up ./plan/context/services/incomplete_unix.cue
|
||||||
|
assert_failure
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "plan/context/services incomplete service" {
|
||||||
|
cd "$TESTDIR"
|
||||||
|
run "$DAGGER" --europa up ./plan/context/services/incomplete_service.cue
|
||||||
|
assert_output --partial "pipeline was partially executed because of missing inputs"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "plan/context/services unix" {
|
||||||
|
cd "$TESTDIR"
|
||||||
|
"$DAGGER" --europa up ./plan/context/services/unix.cue
|
||||||
}
|
}
|
28
tests/plan/context/services/incomplete_service.cue
Normal file
28
tests/plan/context/services/incomplete_service.cue
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"alpha.dagger.io/dagger/engine"
|
||||||
|
"alpha.dagger.io/dagger/op"
|
||||||
|
"alpha.dagger.io/alpine"
|
||||||
|
)
|
||||||
|
|
||||||
|
engine.#Plan & {
|
||||||
|
// should fail
|
||||||
|
context: services: dockerSocket: {}
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
test: #up: [
|
||||||
|
op.#Load & {
|
||||||
|
from: alpine.#Image & {
|
||||||
|
package: "docker-cli": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
op.#Exec & {
|
||||||
|
always: true
|
||||||
|
mount: "/var/run/docker.sock": stream: context.services.dockerSocket.service
|
||||||
|
args: ["docker", "info"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
28
tests/plan/context/services/incomplete_unix.cue
Normal file
28
tests/plan/context/services/incomplete_unix.cue
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"alpha.dagger.io/dagger/engine"
|
||||||
|
"alpha.dagger.io/dagger/op"
|
||||||
|
"alpha.dagger.io/alpine"
|
||||||
|
)
|
||||||
|
|
||||||
|
engine.#Plan & {
|
||||||
|
// should succeed
|
||||||
|
context: services: dockerSocket: unix: string
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
test: #up: [
|
||||||
|
op.#Load & {
|
||||||
|
from: alpine.#Image & {
|
||||||
|
package: "docker-cli": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
op.#Exec & {
|
||||||
|
always: true
|
||||||
|
mount: "/var/run/docker.sock": stream: context.services.dockerSocket.service
|
||||||
|
args: ["docker", "info"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
28
tests/plan/context/services/invalid_schema.cue
Normal file
28
tests/plan/context/services/invalid_schema.cue
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"alpha.dagger.io/dagger/engine"
|
||||||
|
"alpha.dagger.io/dagger/op"
|
||||||
|
"alpha.dagger.io/alpine"
|
||||||
|
)
|
||||||
|
|
||||||
|
engine.#Plan & {
|
||||||
|
// should fail because of misspelled key
|
||||||
|
context: services: dockerSocket: unx: "/var/run/docker.soc"
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
test: #up: [
|
||||||
|
op.#Load & {
|
||||||
|
from: alpine.#Image & {
|
||||||
|
package: "docker-cli": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
op.#Exec & {
|
||||||
|
always: true
|
||||||
|
mount: "/var/run/docker.sock": stream: context.services.dockerSocket.service
|
||||||
|
args: ["docker", "info"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
28
tests/plan/context/services/invalid_value.cue
Normal file
28
tests/plan/context/services/invalid_value.cue
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"alpha.dagger.io/dagger/engine"
|
||||||
|
"alpha.dagger.io/dagger/op"
|
||||||
|
"alpha.dagger.io/alpine"
|
||||||
|
)
|
||||||
|
|
||||||
|
engine.#Plan & {
|
||||||
|
// should fail because of misspelled value
|
||||||
|
context: services: dockerSocket: unix: "/var/run/docker.soc"
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
test: #up: [
|
||||||
|
op.#Load & {
|
||||||
|
from: alpine.#Image & {
|
||||||
|
package: "docker-cli": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
op.#Exec & {
|
||||||
|
always: true
|
||||||
|
mount: "/var/run/docker.sock": stream: context.services.dockerSocket.service
|
||||||
|
args: ["docker", "info"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
28
tests/plan/context/services/unix.cue
Normal file
28
tests/plan/context/services/unix.cue
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"alpha.dagger.io/dagger/engine"
|
||||||
|
"alpha.dagger.io/dagger/op"
|
||||||
|
"alpha.dagger.io/alpine"
|
||||||
|
)
|
||||||
|
|
||||||
|
engine.#Plan & {
|
||||||
|
// should succeed
|
||||||
|
context: services: dockerSocket: unix: "/var/run/docker.sock"
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
test: #up: [
|
||||||
|
op.#Load & {
|
||||||
|
from: alpine.#Image & {
|
||||||
|
package: "docker-cli": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
op.#Exec & {
|
||||||
|
always: true
|
||||||
|
mount: "/var/run/docker.sock": stream: context.services.dockerSocket.service
|
||||||
|
args: ["docker", "info"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -1,25 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"alpha.dagger.io/dagger/engine"
|
|
||||||
"alpha.dagger.io/dagger/op"
|
|
||||||
"alpha.dagger.io/alpine"
|
|
||||||
)
|
|
||||||
|
|
||||||
engine.#Plan & {
|
|
||||||
context: services: dockerSocket: unix: "/var/run/docker.sock"
|
|
||||||
|
|
||||||
actions: {
|
|
||||||
load: op.#Load & {
|
|
||||||
from: alpine.#Image & {
|
|
||||||
package: "docker-cli": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
exec: op.#Exec & {
|
|
||||||
always: true
|
|
||||||
mount: "/var/run/docker.sock": stream: context.services.dockerSocket.service
|
|
||||||
args: ["docker", "info"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user