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

View File

@ -7,11 +7,21 @@ import (
dagger.#Plan & { dagger.#Plan & {
actions: { actions: {
// TODO/FIXME: Use Europa constructs for this image: dagger.#Pull & {
// sayHello: os.#Container & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
// command: "echo Hello Europa! > /out.txt" }
// }
// 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 // should fail due to incomplete service
proxy: dockerSocket: {} proxy: dockerSocket: {}
// TODO/FIXME: Use Europa constructs for this actions: {
// actions: test: #up: [ image: dagger.#Pull & {
// op.#Load & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
// from: alpine.#Image & { }
// package: "docker-cli": true
// }
// },
// op.#Exec & { imageWithDocker: dagger.#Exec & {
// always: true input: image.output
// mount: "/var/run/docker.sock": stream: proxy.dockerSocket.service args: ["apk", "add", "--no-cache", "docker-cli"]
// args: ["docker", "info"] }
// },
// ] 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 // should fail because incomplete value
proxy: dockerSocket: unix: string proxy: dockerSocket: unix: string
// TODO/FIXME: Use Europa constructs for this actions: {
// actions: test: #up: [ image: dagger.#Pull & {
// op.#Load & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
// from: alpine.#Image & { }
// package: "docker-cli": true
// }
// },
// op.#Exec & { imageWithDocker: dagger.#Exec & {
// always: true input: image.output
// mount: "/var/run/docker.sock": stream: proxy.dockerSocket.service args: ["apk", "add", "--no-cache", "docker-cli"]
// args: ["docker", "info"] }
// },
// ] 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 // should fail because of misspelled key
proxy: dockerSocket: unx: "/var/run/docker.sock" proxy: dockerSocket: unx: "/var/run/docker.sock"
// TODO/FIXME: Use Europa constructs for this actions: {
// actions: test: #up: [ image: dagger.#Pull & {
// op.#Load & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
// from: alpine.#Image & { }
// package: "docker-cli": true
// }
// },
// op.#Exec & { imageWithDocker: dagger.#Exec & {
// always: true input: image.output
// mount: "/var/run/docker.sock": stream: proxy.dockerSocket.service args: ["apk", "add", "--no-cache", "docker-cli"]
// args: ["docker", "info"] }
// },
// ] 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 // should fail because of misspelled value
proxy: dockerSocket: unix: "/var/run/docker.soc" proxy: dockerSocket: unix: "/var/run/docker.soc"
// TODO/FIXME: Use Europa constructs for this actions: {
// actions: test: #up: [ image: dagger.#Pull & {
// op.#Load & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
// from: alpine.#Image & { }
// package: "docker-cli": true
// }
// },
// op.#Exec & { imageWithDocker: dagger.#Exec & {
// always: true input: image.output
// mount: "/var/run/docker.sock": stream: proxy.dockerSocket.service args: ["apk", "add", "--no-cache", "docker-cli"]
// args: ["docker", "info"] }
// },
// ] 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 // should succeed
proxy: dockerSocket: unix: "/var/run/docker.sock" proxy: dockerSocket: unix: "/var/run/docker.sock"
// TODO/FIXME: Use Europa constructs for this actions: {
// actions: test: #up: [ image: dagger.#Pull & {
// op.#Load & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
// from: alpine.#Image & { }
// package: "docker-cli": true
// }
// },
// op.#Exec & { imageWithDocker: dagger.#Exec & {
// always: true input: image.output
// mount: "/var/run/docker.sock": stream: proxy.dockerSocket.service args: ["apk", "add", "--no-cache", "docker-cli"]
// args: ["docker", "info"] }
// },
// ] verify: dagger.#Exec & {
input: imageWithDocker.output
mounts: docker: {
dest: "/var/run/docker.sock"
contents: proxy.dockerSocket.service
}
args: ["docker", "info"]
}
}
} }