tests: fix invalid dockerbuild test

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2021-03-31 18:34:23 -07:00
parent 3aec0337d2
commit f1bf58ed86

View File

@ -1,12 +1,15 @@
package test package test
import "dagger.io/dagger" import (
"dagger.io/dagger"
"dagger.io/llb"
)
// Set to `--input-dir=./tests/dockerbuild/testdata` // Set to `--input-dir=./tests/dockerbuild/testdata`
TestData: dagger.#Artifact TestData: dagger.#Artifact
TestInlinedDockerfile: #compute: [ TestInlinedDockerfile: #compute: [
dagger.#DockerBuild & { llb.#DockerBuild & {
dockerfile: """ dockerfile: """
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
RUN echo hello world RUN echo hello world
@ -15,51 +18,51 @@ TestInlinedDockerfile: #compute: [
] ]
TestOpChaining: #compute: [ TestOpChaining: #compute: [
dagger.#DockerBuild & { llb.#DockerBuild & {
dockerfile: """ dockerfile: """
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
RUN echo foobar > /output RUN echo foobar > /output
""" """
}, },
dagger.#Exec & { llb.#Exec & {
args: ["sh", "-c", "test $(cat /output) = foobar"] args: ["sh", "-c", "test $(cat /output) = foobar"]
}, },
] ]
TestBuildContext: #compute: [ TestBuildContext: #compute: [
dagger.#DockerBuild & { llb.#DockerBuild & {
context: TestData context: TestData
}, },
dagger.#Exec & { llb.#Exec & {
args: ["sh", "-c", "test $(cat /dir/foo) = foobar"] args: ["sh", "-c", "test $(cat /dir/foo) = foobar"]
}, },
] ]
TestBuildContextAndDockerfile: #compute: [ TestBuildContextAndDockerfile: #compute: [
dagger.#DockerBuild & { llb.#DockerBuild & {
context: TestData context: TestData
dockerfile: """ dockerfile: """
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
COPY foo /override COPY foo /override
""" """
}, },
dagger.#Exec & { llb.#Exec & {
args: ["sh", "-c", "test $(cat /override) = foobar"] args: ["sh", "-c", "test $(cat /override) = foobar"]
}, },
] ]
TestDockerfilePath: #compute: [ TestDockerfilePath: #compute: [
dagger.#DockerBuild & { llb.#DockerBuild & {
context: TestData context: TestData
dockerfilePath: "./dockerfilepath/Dockerfile.custom" dockerfilePath: "./dockerfilepath/Dockerfile.custom"
}, },
dagger.#Exec & { llb.#Exec & {
args: ["sh", "-c", "test $(cat /test) = dockerfilePath"] args: ["sh", "-c", "test $(cat /test) = dockerfilePath"]
}, },
] ]
TestBuildArgs: #compute: [ TestBuildArgs: #compute: [
dagger.#DockerBuild & { llb.#DockerBuild & {
dockerfile: """ dockerfile: """
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
ARG TEST=foo ARG TEST=foo
@ -71,7 +74,7 @@ TestBuildArgs: #compute: [
// FIXME: this doesn't test anything beside not crashing // FIXME: this doesn't test anything beside not crashing
TestBuildLabels: #compute: [ TestBuildLabels: #compute: [
dagger.#DockerBuild & { llb.#DockerBuild & {
dockerfile: """ dockerfile: """
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
""" """
@ -81,7 +84,7 @@ TestBuildLabels: #compute: [
// FIXME: this doesn't test anything beside not crashing // FIXME: this doesn't test anything beside not crashing
TestBuildPlatform: #compute: [ TestBuildPlatform: #compute: [
dagger.#DockerBuild & { llb.#DockerBuild & {
dockerfile: """ dockerfile: """
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
""" """