Update plan tests to use Europa constructs

Signed-off-by: Joel Longtine <joel@dagger.io>
This commit is contained in:
Joel Longtine 2022-02-22 13:21:32 -07:00
parent 2caccc69e8
commit 70c0f362ea
7 changed files with 115 additions and 82 deletions

View File

@ -16,12 +16,11 @@ setup() {
assert_failure
}
# TODO/FIXME: this test is broken, it's not asserting that the proxy is not running
# @test "plan/proxy invalid value" {
# cd "$TESTDIR"
# run "$DAGGER" up ./plan/proxy/invalid_value.cue
# assert_failure
# }
@test "plan/proxy invalid value" {
cd "$TESTDIR"
run "$DAGGER" up ./plan/proxy/invalid_value.cue
assert_failure
}
@test "plan/proxy incomplete unix" {
cd "$TESTDIR"
@ -29,12 +28,11 @@ setup() {
assert_failure
}
# TODO/FIXME: this test is broken, it's not asserting that the proxy is not running
# @test "plan/proxy incomplete service" {
# cd "$TESTDIR"
# run "$DAGGER" up ./plan/proxy/incomplete_service.cue
# assert_output --partial "pipeline was partially executed because of missing inputs"
# }
@test "plan/proxy incomplete service" {
cd "$TESTDIR"
run "$DAGGER" up ./plan/proxy/incomplete_service.cue
assert_output --partial 'mount "docker" is not concrete'
}
@test "plan/proxy unix" {
cd "$TESTDIR"

View File

@ -7,11 +7,21 @@ import (
dagger.#Plan & {
actions: {
// TODO/FIXME: Use Europa constructs for this
// sayHello: os.#Container & {
// command: "echo Hello Europa! > /out.txt"
// }
image: dagger.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
// verify: "Hello Europa!\n" & (os.#File & {from: sayHello, path: "/out.txt"}).contents
exec: dagger.#Exec & {
input: image.output
args: ["sh", "-c", "echo -n Hello Europa > /out.txt"]
}
verify: dagger.#ReadFile & {
input: exec.output
path: "/out.txt"
} & {
// assert result
contents: "Hello Europa"
}
}
}

View File

@ -10,18 +10,23 @@ dagger.#Plan & {
// should fail due to incomplete service
proxy: dockerSocket: {}
// TODO/FIXME: Use Europa constructs for this
// actions: test: #up: [
// op.#Load & {
// from: alpine.#Image & {
// package: "docker-cli": true
// }
// },
actions: {
image: dagger.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
// op.#Exec & {
// always: true
// mount: "/var/run/docker.sock": stream: proxy.dockerSocket.service
// args: ["docker", "info"]
// },
// ]
imageWithDocker: dagger.#Exec & {
input: image.output
args: ["apk", "add", "--no-cache", "docker-cli"]
}
verify: dagger.#Exec & {
input: imageWithDocker.output
mounts: docker: {
dest: "/var/run/docker.sock"
contents: proxy.dockerSocket.service
}
args: ["docker", "info"]
}
}
}

View File

@ -10,18 +10,23 @@ dagger.#Plan & {
// should fail because incomplete value
proxy: dockerSocket: unix: string
// TODO/FIXME: Use Europa constructs for this
// actions: test: #up: [
// op.#Load & {
// from: alpine.#Image & {
// package: "docker-cli": true
// }
// },
actions: {
image: dagger.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
// op.#Exec & {
// always: true
// mount: "/var/run/docker.sock": stream: proxy.dockerSocket.service
// args: ["docker", "info"]
// },
// ]
imageWithDocker: dagger.#Exec & {
input: image.output
args: ["apk", "add", "--no-cache", "docker-cli"]
}
verify: dagger.#Exec & {
input: imageWithDocker.output
mounts: docker: {
dest: "/var/run/docker.sock"
contents: proxy.dockerSocket.service
}
args: ["docker", "info"]
}
}
}

View File

@ -10,18 +10,23 @@ dagger.#Plan & {
// should fail because of misspelled key
proxy: dockerSocket: unx: "/var/run/docker.sock"
// TODO/FIXME: Use Europa constructs for this
// actions: test: #up: [
// op.#Load & {
// from: alpine.#Image & {
// package: "docker-cli": true
// }
// },
actions: {
image: dagger.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
// op.#Exec & {
// always: true
// mount: "/var/run/docker.sock": stream: proxy.dockerSocket.service
// args: ["docker", "info"]
// },
// ]
imageWithDocker: dagger.#Exec & {
input: image.output
args: ["apk", "add", "--no-cache", "docker-cli"]
}
verify: dagger.#Exec & {
input: imageWithDocker.output
mounts: docker: {
dest: "/var/run/docker.sock"
contents: proxy.dockerSocket.service
}
args: ["docker", "info"]
}
}
}

View File

@ -10,18 +10,23 @@ dagger.#Plan & {
// should fail because of misspelled value
proxy: dockerSocket: unix: "/var/run/docker.soc"
// TODO/FIXME: Use Europa constructs for this
// actions: test: #up: [
// op.#Load & {
// from: alpine.#Image & {
// package: "docker-cli": true
// }
// },
actions: {
image: dagger.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
// op.#Exec & {
// always: true
// mount: "/var/run/docker.sock": stream: proxy.dockerSocket.service
// args: ["docker", "info"]
// },
// ]
imageWithDocker: dagger.#Exec & {
input: image.output
args: ["apk", "add", "--no-cache", "docker-cli"]
}
verify: dagger.#Exec & {
input: imageWithDocker.output
mounts: docker: {
dest: "/var/run/docker.sock"
contents: proxy.dockerSocket.service
}
args: ["docker", "info"]
}
}
}

View File

@ -10,18 +10,23 @@ dagger.#Plan & {
// should succeed
proxy: dockerSocket: unix: "/var/run/docker.sock"
// TODO/FIXME: Use Europa constructs for this
// actions: test: #up: [
// op.#Load & {
// from: alpine.#Image & {
// package: "docker-cli": true
// }
// },
actions: {
image: dagger.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
// op.#Exec & {
// always: true
// mount: "/var/run/docker.sock": stream: proxy.dockerSocket.service
// args: ["docker", "info"]
// },
// ]
imageWithDocker: dagger.#Exec & {
input: image.output
args: ["apk", "add", "--no-cache", "docker-cli"]
}
verify: dagger.#Exec & {
input: imageWithDocker.output
mounts: docker: {
dest: "/var/run/docker.sock"
contents: proxy.dockerSocket.service
}
args: ["docker", "info"]
}
}
}