removed dagger up in favor of dagger do
Signed-off-by: Richard Jones <richard@dagger.io>
This commit is contained in:
@@ -198,12 +198,12 @@ setup() {
|
||||
cd "$TESTDIR"
|
||||
|
||||
# Run with amd64 platform
|
||||
run "$DAGGER" up ./plan/platform/config_platform_linux_amd64.cue
|
||||
run "$DAGGER" "do" -p./plan/platform/config_platform_linux_amd64.cue verify
|
||||
|
||||
# Run with arm64 platform
|
||||
run "$DAGGER" up ./plan/platform/config_platform_linux_arm64.cue
|
||||
run "$DAGGER" "do" -p./plan/platform/config_platform_linux_arm64.cue verify
|
||||
|
||||
# Run with invalid platform
|
||||
run "$DAGGER" up ./plan/platform/config_platform_failure_invalid_platform.cue
|
||||
run "$DAGGER" "do" -p./plan/platform/config_platform_failure_invalid_platform.cue verify
|
||||
assert_failure
|
||||
}
|
||||
|
136
tests/tasks.bats
136
tests/tasks.bats
@@ -2,153 +2,129 @@ setup() {
|
||||
load 'helpers'
|
||||
|
||||
common_setup
|
||||
cd "$TESTDIR" || exit
|
||||
}
|
||||
|
||||
@test "task: #Pull" {
|
||||
cd "$TESTDIR"/tasks/pull
|
||||
"$DAGGER" up ./pull.cue
|
||||
}
|
||||
|
||||
@test "task: #Pull with auth" {
|
||||
cd "$TESTDIR"
|
||||
"$DAGGER" up ./tasks/pull/pull_auth.cue
|
||||
"$DAGGER" "do" -p ./tasks/pull/pull.cue pull
|
||||
"$DAGGER" "do" -p ./tasks/pull/pull_auth.cue pull
|
||||
}
|
||||
|
||||
@test "task: #Push" {
|
||||
cd "$TESTDIR"
|
||||
"$DAGGER" up ./tasks/push/push.cue
|
||||
"$DAGGER" "do" -p ./tasks/push/push.cue pullContent
|
||||
}
|
||||
|
||||
@test "task: #ReadFile" {
|
||||
cd "$TESTDIR"/tasks/readfile
|
||||
"$DAGGER" up
|
||||
"$DAGGER" "do" -p ./tasks/readfile/readfile.cue readfile
|
||||
}
|
||||
|
||||
@test "task: #WriteFile" {
|
||||
cd "$TESTDIR"/tasks/writefile
|
||||
"$DAGGER" up ./writefile.cue
|
||||
}
|
||||
|
||||
@test "task: #WriteFile failure: different contents" {
|
||||
cd "$TESTDIR"/tasks/writefile
|
||||
run "$DAGGER" up ./writefile_failure_diff_contents.cue
|
||||
"$DAGGER" "do" -p ./tasks/writefile/writefile.cue readfile
|
||||
run "$DAGGER" "do" -p ./tasks/writefile/writefile_failure_diff_contents.cue readfile
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "task: #Exec" {
|
||||
cd "$TESTDIR"/tasks/exec
|
||||
"$DAGGER" up ./args.cue
|
||||
"$DAGGER" up ./env.cue
|
||||
"$DAGGER" up ./env_secret.cue
|
||||
"$DAGGER" up ./hosts.cue
|
||||
cd ./tasks/exec
|
||||
"$DAGGER" "do" -p ./args.cue verify
|
||||
"$DAGGER" "do" -p ./env.cue verify
|
||||
"$DAGGER" "do" -p ./env_secret.cue verify
|
||||
"$DAGGER" "do" -p ./hosts.cue verify
|
||||
|
||||
"$DAGGER" up ./mount_cache.cue
|
||||
"$DAGGER" up ./mount_fs.cue
|
||||
TESTSECRET="hello world" "$DAGGER" up ./mount_secret.cue
|
||||
"$DAGGER" up ./mount_tmp.cue
|
||||
"$DAGGER" up ./mount_service.cue
|
||||
"$DAGGER" "do" -p ./mount_cache.cue test
|
||||
"$DAGGER" "do" -p ./mount_fs.cue test
|
||||
TESTSECRET="hello world" "$DAGGER" "do" -p ./mount_secret.cue test
|
||||
"$DAGGER" "do" -p ./mount_tmp.cue verify
|
||||
"$DAGGER" "do" -p ./mount_service.cue verify
|
||||
|
||||
"$DAGGER" up ./user.cue
|
||||
"$DAGGER" up ./workdir.cue
|
||||
"$DAGGER" "do" -p ./user.cue test
|
||||
"$DAGGER" "do" -p ./workdir.cue verify
|
||||
}
|
||||
|
||||
@test "task: #Copy" {
|
||||
cd "$TESTDIR"/tasks/copy
|
||||
"$DAGGER" up ./copy_exec.cue
|
||||
"$DAGGER" up ./copy_file.cue
|
||||
"$DAGGER" "do" -p ./tasks/copy/copy_exec.cue test
|
||||
"$DAGGER" "do" -p ./tasks/copy/copy_file.cue test
|
||||
|
||||
run "$DAGGER" up ./copy_exec_invalid.cue
|
||||
run "$DAGGER" "do" -p ./tasks/copy/copy_exec_invalid.cue test
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "task: #Mkdir" {
|
||||
# Make directory
|
||||
cd "$TESTDIR"/tasks/mkdir
|
||||
"$DAGGER" up ./mkdir.cue
|
||||
"$DAGGER" "do" -p ./tasks/mkdir/mkdir.cue readChecker
|
||||
|
||||
# Create parents
|
||||
cd "$TESTDIR"/tasks/mkdir
|
||||
"$DAGGER" up ./mkdir_parents.cue
|
||||
"$DAGGER" "do" -p ./tasks/mkdir/mkdir_parents.cue readChecker
|
||||
|
||||
# Disable parents creation
|
||||
cd "$TESTDIR"/tasks/mkdir
|
||||
run "$DAGGER" up ./mkdir_failure_disable_parents.cue
|
||||
run "$DAGGER" "do" -p ./tasks/mkdir/mkdir_failure_disable_parents.cue readChecker
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "task: #Dockerfile" {
|
||||
cd "$TESTDIR"/tasks/dockerfile
|
||||
|
||||
"$DAGGER" up ./dockerfile.cue
|
||||
"$DAGGER" up ./inlined_dockerfile.cue
|
||||
"$DAGGER" up ./inlined_dockerfile_heredoc.cue
|
||||
"$DAGGER" up ./dockerfile_path.cue
|
||||
"$DAGGER" up ./build_args.cue
|
||||
"$DAGGER" up ./image_config.cue
|
||||
"$DAGGER" up ./labels.cue
|
||||
"$DAGGER" up ./platform.cue
|
||||
"$DAGGER" up ./build_auth.cue
|
||||
"$DAGGER" "do" -p ./dockerfile.cue
|
||||
"$DAGGER" "do" -p ./inlined_dockerfile.cue verify
|
||||
"$DAGGER" "do" -p ./inlined_dockerfile_heredoc.cue verify
|
||||
"$DAGGER" "do" -p ./dockerfile_path.cue verify
|
||||
"$DAGGER" "do" -p ./build_args.cue build
|
||||
"$DAGGER" "do" -p ./image_config.cue build
|
||||
"$DAGGER" "do" -p ./labels.cue build
|
||||
"$DAGGER" "do" -p ./platform.cue build
|
||||
"$DAGGER" "do" -p ./build_auth.cue build
|
||||
}
|
||||
|
||||
@test "task: #Scratch" {
|
||||
cd "$TESTDIR"/tasks/scratch
|
||||
"$DAGGER" up ./scratch.cue -l debug
|
||||
"$DAGGER" up ./scratch_build_scratch.cue -l debug
|
||||
"$DAGGER" up ./scratch_writefile.cue -l debug
|
||||
"$DAGGER" "do" -p ./tasks/scratch/scratch.cue exec
|
||||
"$DAGGER" "do" -p ./tasks/scratch/scratch_build_scratch.cue build
|
||||
"$DAGGER" "do" -p ./tasks/scratch/scratch_writefile.cue readfile
|
||||
}
|
||||
|
||||
@test "task: #Subdir" {
|
||||
cd "$TESTDIR"/tasks/subdir
|
||||
"$DAGGER" up ./subdir_simple.cue
|
||||
"$DAGGER" "do" -p ./tasks/subdir/subdir_simple.cue verify
|
||||
|
||||
run "$DAGGER" up ./subdir_invalid_path.cue
|
||||
run "$DAGGER" "do" -p ./tasks/subdir/subdir_invalid_path.cue verify
|
||||
assert_failure
|
||||
|
||||
run "$DAGGER" up ./subdir_invalid_exec.cue
|
||||
run "$DAGGER" "do" -p ./tasks/subdir/subdir_invalid_exec.cue verify
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "task: #GitPull" {
|
||||
cd "$TESTDIR"
|
||||
"$DAGGER" up ./tasks/gitpull/exists.cue
|
||||
"$DAGGER" up ./tasks/gitpull/git_dir.cue
|
||||
"$DAGGER" up ./tasks/gitpull/private_repo.cue
|
||||
"$DAGGER" "do" -p ./tasks/gitpull/exists.cue gitPull
|
||||
"$DAGGER" "do" -p ./tasks/gitpull/git_dir.cue verify
|
||||
"$DAGGER" "do" -p ./tasks/gitpull/private_repo.cue testContent
|
||||
|
||||
run "$DAGGER" up ./tasks/gitpull/invalid.cue
|
||||
run "$DAGGER" "do" -p ./tasks/gitpull/invalid.cue invalid
|
||||
assert_failure
|
||||
run "$DAGGER" up ./tasks/gitpull/bad_remote.cue
|
||||
run "$DAGGER" "do" -p ./tasks/gitpull/bad_remote.cue badremote
|
||||
assert_failure
|
||||
run "$DAGGER" up ./tasks/gitpull/bad_ref.cue
|
||||
run "$DAGGER" "do" -p ./tasks/gitpull/bad_ref.cue badref
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "task: #HTTPFetch" {
|
||||
cd "$TESTDIR"
|
||||
"$DAGGER" up ./tasks/httpfetch/exist.cue
|
||||
run "$DAGGER" up ./tasks/httpfetch/not_exist.cue
|
||||
"$DAGGER" "do" -p ./tasks/httpfetch/exist.cue fetch
|
||||
run "$DAGGER" "do" -p ./tasks/httpfetch/not_exist.cue fetch
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "task: #NewSecret" {
|
||||
cd "$TESTDIR"/tasks/newsecret
|
||||
|
||||
"$DAGGER" up ./newsecret.cue
|
||||
"$DAGGER" "do" -p ./tasks/newsecret/newsecret.cue verify
|
||||
}
|
||||
|
||||
@test "task: #TrimSecret" {
|
||||
cd "$TESTDIR"/tasks/trimsecret
|
||||
|
||||
"$DAGGER" up ./trimsecret.cue
|
||||
"$DAGGER" "do" -p ./tasks/trimsecret/trimsecret.cue verify
|
||||
}
|
||||
|
||||
@test "task: #Source" {
|
||||
cd "$TESTDIR"/tasks/source
|
||||
"$DAGGER" up ./source.cue
|
||||
"$DAGGER" up ./source_include_exclude.cue
|
||||
"$DAGGER" up ./source_relative.cue
|
||||
"$DAGGER" "do" -p ./tasks/source/source.cue test
|
||||
"$DAGGER" "do" -p ./tasks/source/source_include_exclude.cue test
|
||||
"$DAGGER" "do" -p ./tasks/source/source_relative.cue verifyHello
|
||||
|
||||
run "$DAGGER" up ./source_invalid_path.cue
|
||||
run "$DAGGER" "do" -p ./tasks/source/source_invalid_path.cue source
|
||||
assert_failure
|
||||
|
||||
run "$DAGGER" up ./source_not_exist.cue
|
||||
run "$DAGGER" "do" -p ./tasks/source/source_not_exist.cue source
|
||||
assert_failure
|
||||
}
|
||||
|
@@ -19,28 +19,29 @@ dagger.#Plan & {
|
||||
"""#,
|
||||
]
|
||||
}
|
||||
test: {
|
||||
verify_file: dagger.#ReadFile & {
|
||||
input: exec.output
|
||||
path: "/output.txt"
|
||||
} & {
|
||||
// assert result
|
||||
contents: "hello world"
|
||||
}
|
||||
|
||||
verify_file: dagger.#ReadFile & {
|
||||
input: exec.output
|
||||
path: "/output.txt"
|
||||
} & {
|
||||
// assert result
|
||||
contents: "hello world"
|
||||
}
|
||||
copy: dagger.#Copy & {
|
||||
input: image.output
|
||||
contents: exec.output
|
||||
source: "/output.txt"
|
||||
dest: "/output.txt"
|
||||
}
|
||||
|
||||
copy: dagger.#Copy & {
|
||||
input: image.output
|
||||
contents: exec.output
|
||||
source: "/output.txt"
|
||||
dest: "/output.txt"
|
||||
}
|
||||
|
||||
verify_copy: dagger.#ReadFile & {
|
||||
input: copy.output
|
||||
path: "/output.txt"
|
||||
} & {
|
||||
// assert result
|
||||
contents: "hello world"
|
||||
verify_copy: dagger.#ReadFile & {
|
||||
input: copy.output
|
||||
path: "/output.txt"
|
||||
} & {
|
||||
// assert result
|
||||
contents: "hello world"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -20,26 +20,28 @@ dagger.#Plan & {
|
||||
]
|
||||
}
|
||||
|
||||
verify_file: dagger.#ReadFile & {
|
||||
input: exec.output
|
||||
path: "/output.txt"
|
||||
} & {
|
||||
// assert result
|
||||
contents: "hello world from dagger"
|
||||
}
|
||||
test: {
|
||||
verify_file: dagger.#ReadFile & {
|
||||
input: exec.output
|
||||
path: "/output.txt"
|
||||
} & {
|
||||
// assert result
|
||||
contents: "hello world from dagger"
|
||||
}
|
||||
|
||||
copy: dagger.#Copy & {
|
||||
input: image.output
|
||||
contents: exec.output
|
||||
source: "/output.txt"
|
||||
dest: "/output.txt"
|
||||
}
|
||||
verify_copy: dagger.#ReadFile & {
|
||||
input: copy.output
|
||||
path: "/output.txt"
|
||||
} & {
|
||||
// assert result
|
||||
contents: "hello world"
|
||||
copy: dagger.#Copy & {
|
||||
input: image.output
|
||||
contents: exec.output
|
||||
source: "/output.txt"
|
||||
dest: "/output.txt"
|
||||
}
|
||||
verify_copy: dagger.#ReadFile & {
|
||||
input: copy.output
|
||||
path: "/output.txt"
|
||||
} & {
|
||||
// assert result
|
||||
contents: "hello world"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -14,27 +14,29 @@ dagger.#Plan & {
|
||||
source: "busybox:1.34.1-glibc@sha256:ec98391b8f0911db08be2ee6c46813eeac17b9625b402ea1ce45dcfcd05d78d6"
|
||||
}
|
||||
|
||||
verify_alpine_3_15_0: dagger.#ReadFile & {
|
||||
input: alpine3_15_0.output
|
||||
path: "/etc/alpine-release"
|
||||
} & {
|
||||
// assert result
|
||||
contents: "3.15.0\n"
|
||||
}
|
||||
test: {
|
||||
verify_alpine_3_15_0: dagger.#ReadFile & {
|
||||
input: alpine3_15_0.output
|
||||
path: "/etc/alpine-release"
|
||||
} & {
|
||||
// assert result
|
||||
contents: "3.15.0\n"
|
||||
}
|
||||
|
||||
copy: dagger.#Copy & {
|
||||
input: busybox1_34_1.output
|
||||
contents: alpine3_15_0.output
|
||||
source: "/etc/alpine-release"
|
||||
dest: "/alpine3_15_0_release"
|
||||
}
|
||||
copy: dagger.#Copy & {
|
||||
input: busybox1_34_1.output
|
||||
contents: alpine3_15_0.output
|
||||
source: "/etc/alpine-release"
|
||||
dest: "/alpine3_15_0_release"
|
||||
}
|
||||
|
||||
verify_copy: dagger.#ReadFile & {
|
||||
input: copy.output
|
||||
path: "/alpine3_15_0_release"
|
||||
} & {
|
||||
// assert result
|
||||
contents: "3.15.0\n"
|
||||
verify_copy: dagger.#ReadFile & {
|
||||
input: copy.output
|
||||
path: "/alpine3_15_0_release"
|
||||
} & {
|
||||
// assert result
|
||||
contents: "3.15.0\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -22,73 +22,3 @@ dagger.#Plan & {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestDockerfilePath: #up: [
|
||||
// op.#DockerBuild & {
|
||||
// context: TestData
|
||||
// dockerfilePath: "./dockerfilepath/Dockerfile.custom"
|
||||
// },
|
||||
// op.#Exec & {
|
||||
// args: ["sh", "-c", "test $(cat /test) = dockerfilePath"]
|
||||
// },
|
||||
// ]
|
||||
|
||||
// TestBuildArgs: #up: [
|
||||
// op.#DockerBuild & {
|
||||
// dockerfile: """
|
||||
// FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
||||
// ARG TEST=foo
|
||||
// RUN test "${TEST}" = "bar"
|
||||
// """
|
||||
// buildArg: TEST: "bar"
|
||||
// },
|
||||
// ]
|
||||
|
||||
// // FIXME: this doesn't test anything beside not crashing
|
||||
// TestBuildLabels: #up: [
|
||||
// op.#DockerBuild & {
|
||||
// dockerfile: """
|
||||
// FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
||||
// """
|
||||
// label: FOO: "bar"
|
||||
// },
|
||||
// ]
|
||||
|
||||
// // FIXME: this doesn't test anything beside not crashing
|
||||
// TestBuildPlatform: #up: [
|
||||
// op.#DockerBuild & {
|
||||
// dockerfile: """
|
||||
// FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
||||
// """
|
||||
// platforms: ["linux/amd64"]
|
||||
// },
|
||||
// ]
|
||||
|
||||
// TestImageMetadata: #up: [
|
||||
// op.#DockerBuild & {
|
||||
// dockerfile: """
|
||||
// FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
||||
// ENV CHECK foobar
|
||||
// ENV DOUBLECHECK test
|
||||
// """
|
||||
// },
|
||||
// op.#Exec & {
|
||||
// args: ["sh", "-c", #"""
|
||||
// env
|
||||
// test "$CHECK" = "foobar"
|
||||
// """#]
|
||||
// },
|
||||
// ]
|
||||
|
||||
// // Make sure the metadata is carried over with a `Load`
|
||||
// TestImageMetadataIndirect: #up: [
|
||||
// op.#Load & {
|
||||
// from: TestImageMetadata
|
||||
// },
|
||||
// op.#Exec & {
|
||||
// args: ["sh", "-c", #"""
|
||||
// env
|
||||
// test "$DOUBLECHECK" = "test"
|
||||
// """#]
|
||||
// },
|
||||
// ]
|
||||
|
@@ -23,73 +23,3 @@ dagger.#Plan & {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestDockerfilePath: #up: [
|
||||
// op.#DockerBuild & {
|
||||
// context: TestData
|
||||
// dockerfilePath: "./dockerfilepath/Dockerfile.custom"
|
||||
// },
|
||||
// op.#Exec & {
|
||||
// args: ["sh", "-c", "test $(cat /test) = dockerfilePath"]
|
||||
// },
|
||||
// ]
|
||||
|
||||
// TestBuildArgs: #up: [
|
||||
// op.#DockerBuild & {
|
||||
// dockerfile: """
|
||||
// FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
||||
// ARG TEST=foo
|
||||
// RUN test "${TEST}" = "bar"
|
||||
// """
|
||||
// buildArg: TEST: "bar"
|
||||
// },
|
||||
// ]
|
||||
|
||||
// // FIXME: this doesn't test anything beside not crashing
|
||||
// TestBuildLabels: #up: [
|
||||
// op.#DockerBuild & {
|
||||
// dockerfile: """
|
||||
// FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
||||
// """
|
||||
// label: FOO: "bar"
|
||||
// },
|
||||
// ]
|
||||
|
||||
// // FIXME: this doesn't test anything beside not crashing
|
||||
// TestBuildPlatform: #up: [
|
||||
// op.#DockerBuild & {
|
||||
// dockerfile: """
|
||||
// FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
||||
// """
|
||||
// platforms: ["linux/amd64"]
|
||||
// },
|
||||
// ]
|
||||
|
||||
// TestImageMetadata: #up: [
|
||||
// op.#DockerBuild & {
|
||||
// dockerfile: """
|
||||
// FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
||||
// ENV CHECK foobar
|
||||
// ENV DOUBLECHECK test
|
||||
// """
|
||||
// },
|
||||
// op.#Exec & {
|
||||
// args: ["sh", "-c", #"""
|
||||
// env
|
||||
// test "$CHECK" = "foobar"
|
||||
// """#]
|
||||
// },
|
||||
// ]
|
||||
|
||||
// // Make sure the metadata is carried over with a `Load`
|
||||
// TestImageMetadataIndirect: #up: [
|
||||
// op.#Load & {
|
||||
// from: TestImageMetadata
|
||||
// },
|
||||
// op.#Exec & {
|
||||
// args: ["sh", "-c", #"""
|
||||
// env
|
||||
// test "$DOUBLECHECK" = "test"
|
||||
// """#]
|
||||
// },
|
||||
// ]
|
||||
|
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
dagger.#Plan & {
|
||||
client: filesystem: "secret.txt": read: contents: dagger.#Secret
|
||||
|
||||
actions: {
|
||||
image: dagger.#Pull & {
|
||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||
|
@@ -28,36 +28,38 @@ dagger.#Plan & {
|
||||
]
|
||||
}
|
||||
|
||||
verify: dagger.#Exec & {
|
||||
input: image.output
|
||||
mounts: cache: {
|
||||
dest: "/cache"
|
||||
contents: exec.mounts.cache.contents
|
||||
test: {
|
||||
verify: dagger.#Exec & {
|
||||
input: image.output
|
||||
mounts: cache: {
|
||||
dest: "/cache"
|
||||
contents: exec.mounts.cache.contents
|
||||
}
|
||||
args: [
|
||||
"sh", "-c",
|
||||
#"""
|
||||
test -f /cache/output.txt
|
||||
test "$(cat /cache/output.txt)" = "hello world"
|
||||
"""#,
|
||||
]
|
||||
}
|
||||
args: [
|
||||
"sh", "-c",
|
||||
#"""
|
||||
test -f /cache/output.txt
|
||||
test "$(cat /cache/output.txt)" = "hello world"
|
||||
"""#,
|
||||
]
|
||||
}
|
||||
|
||||
otherCache: dagger.#CacheDir & {
|
||||
id: "othercache"
|
||||
}
|
||||
verifyOtherCache: dagger.#Exec & {
|
||||
input: image.output
|
||||
mounts: cache: {
|
||||
dest: "/cache"
|
||||
contents: otherCache
|
||||
otherCache: dagger.#CacheDir & {
|
||||
id: "othercache"
|
||||
}
|
||||
verifyOtherCache: dagger.#Exec & {
|
||||
input: image.output
|
||||
mounts: cache: {
|
||||
dest: "/cache"
|
||||
contents: otherCache
|
||||
}
|
||||
args: [
|
||||
"sh", "-c",
|
||||
#"""
|
||||
test ! -f /cache/output.txt
|
||||
"""#,
|
||||
]
|
||||
}
|
||||
args: [
|
||||
"sh", "-c",
|
||||
#"""
|
||||
test ! -f /cache/output.txt
|
||||
"""#,
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -20,52 +20,54 @@ dagger.#Plan & {
|
||||
]
|
||||
}
|
||||
|
||||
verify: dagger.#Exec & {
|
||||
input: image.output
|
||||
mounts: fs: {
|
||||
dest: "/target"
|
||||
contents: exec.output
|
||||
test: {
|
||||
verify: dagger.#Exec & {
|
||||
input: image.output
|
||||
mounts: fs: {
|
||||
dest: "/target"
|
||||
contents: exec.output
|
||||
}
|
||||
args: [
|
||||
"sh", "-c",
|
||||
#"""
|
||||
test "$(cat /target/output.txt)" = "hello world"
|
||||
touch /target/rw
|
||||
"""#,
|
||||
]
|
||||
}
|
||||
args: [
|
||||
"sh", "-c",
|
||||
#"""
|
||||
test "$(cat /target/output.txt)" = "hello world"
|
||||
touch /target/rw
|
||||
"""#,
|
||||
]
|
||||
}
|
||||
|
||||
verifyRO: dagger.#Exec & {
|
||||
input: image.output
|
||||
mounts: fs: {
|
||||
dest: "/target"
|
||||
contents: exec.output
|
||||
ro: true
|
||||
verifyRO: dagger.#Exec & {
|
||||
input: image.output
|
||||
mounts: fs: {
|
||||
dest: "/target"
|
||||
contents: exec.output
|
||||
ro: true
|
||||
}
|
||||
args: [
|
||||
"sh", "-c",
|
||||
#"""
|
||||
test "$(cat /target/output.txt)" = "hello world"
|
||||
|
||||
touch /target/ro && exit 1
|
||||
true
|
||||
"""#,
|
||||
]
|
||||
}
|
||||
args: [
|
||||
"sh", "-c",
|
||||
#"""
|
||||
test "$(cat /target/output.txt)" = "hello world"
|
||||
|
||||
touch /target/ro && exit 1
|
||||
true
|
||||
"""#,
|
||||
]
|
||||
}
|
||||
|
||||
verifySource: dagger.#Exec & {
|
||||
input: image.output
|
||||
mounts: fs: {
|
||||
dest: "/target.txt"
|
||||
contents: exec.output
|
||||
source: "/output.txt"
|
||||
verifySource: dagger.#Exec & {
|
||||
input: image.output
|
||||
mounts: fs: {
|
||||
dest: "/target.txt"
|
||||
contents: exec.output
|
||||
source: "/output.txt"
|
||||
}
|
||||
args: [
|
||||
"sh", "-c",
|
||||
#"""
|
||||
test "$(cat /target.txt)" = "hello world"
|
||||
"""#,
|
||||
]
|
||||
}
|
||||
args: [
|
||||
"sh", "-c",
|
||||
#"""
|
||||
test "$(cat /target.txt)" = "hello world"
|
||||
"""#,
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -11,39 +11,40 @@ dagger.#Plan & {
|
||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||
}
|
||||
|
||||
verify: dagger.#Exec & {
|
||||
input: image.output
|
||||
mounts: secret: {
|
||||
dest: "/run/secrets/test"
|
||||
contents: client.env.TESTSECRET
|
||||
test: {
|
||||
verify: dagger.#Exec & {
|
||||
input: image.output
|
||||
mounts: secret: {
|
||||
dest: "/run/secrets/test"
|
||||
contents: client.env.TESTSECRET
|
||||
}
|
||||
args: [
|
||||
"sh", "-c",
|
||||
#"""
|
||||
test "$(cat /run/secrets/test)" = "hello world"
|
||||
ls -l /run/secrets/test | grep -- "-r--------"
|
||||
"""#,
|
||||
]
|
||||
}
|
||||
args: [
|
||||
"sh", "-c",
|
||||
#"""
|
||||
test "$(cat /run/secrets/test)" = "hello world"
|
||||
ls -l /run/secrets/test | grep -- "-r--------"
|
||||
"""#,
|
||||
]
|
||||
}
|
||||
|
||||
verifyPerm: dagger.#Exec & {
|
||||
input: image.output
|
||||
mounts: secret: {
|
||||
dest: "/run/secrets/test"
|
||||
contents: client.env.TESTSECRET
|
||||
uid: 42
|
||||
gid: 24
|
||||
mask: 0o666
|
||||
verifyPerm: dagger.#Exec & {
|
||||
input: image.output
|
||||
mounts: secret: {
|
||||
dest: "/run/secrets/test"
|
||||
contents: client.env.TESTSECRET
|
||||
uid: 42
|
||||
gid: 24
|
||||
mask: 0o666
|
||||
}
|
||||
args: [
|
||||
"sh", "-c",
|
||||
#"""
|
||||
ls -l /run/secrets/test | grep -- "-rw-rw-rw-"
|
||||
ls -l /run/secrets/test | grep -- "42"
|
||||
ls -l /run/secrets/test | grep -- "24"
|
||||
"""#,
|
||||
]
|
||||
}
|
||||
args: [
|
||||
"sh", "-c",
|
||||
#"""
|
||||
ls -l /run/secrets/test | grep -- "-rw-rw-rw-"
|
||||
ls -l /run/secrets/test | grep -- "42"
|
||||
ls -l /run/secrets/test | grep -- "24"
|
||||
"""#,
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -14,28 +14,28 @@ dagger.#Plan & {
|
||||
input: image.output
|
||||
args: ["adduser", "-D", "test"]
|
||||
}
|
||||
test: {
|
||||
verifyUsername: dagger.#Exec & {
|
||||
input: addUser.output
|
||||
user: "test"
|
||||
args: [
|
||||
"sh", "-c",
|
||||
#"""
|
||||
test "$(whoami)" = "test"
|
||||
"""#,
|
||||
]
|
||||
}
|
||||
|
||||
verifyUsername: dagger.#Exec & {
|
||||
input: addUser.output
|
||||
user: "test"
|
||||
args: [
|
||||
"sh", "-c",
|
||||
#"""
|
||||
test "$(whoami)" = "test"
|
||||
"""#,
|
||||
]
|
||||
verifyUserID: dagger.#Exec & {
|
||||
input: addUser.output
|
||||
user: "1000"
|
||||
args: [
|
||||
"sh", "-c",
|
||||
#"""
|
||||
test "$(whoami)" = "test"
|
||||
"""#,
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
verifyUserID: dagger.#Exec & {
|
||||
input: addUser.output
|
||||
user: "1000"
|
||||
args: [
|
||||
"sh", "-c",
|
||||
#"""
|
||||
test "$(whoami)" = "test"
|
||||
"""#,
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -23,20 +23,22 @@ dagger.#Plan & {
|
||||
args: ["/src/test.sh"]
|
||||
}
|
||||
|
||||
verifyHello: dagger.#ReadFile & {
|
||||
input: source.output
|
||||
path: "/world.txt"
|
||||
} & {
|
||||
// assert result
|
||||
contents: "world\n"
|
||||
}
|
||||
test: {
|
||||
verifyHello: dagger.#ReadFile & {
|
||||
input: source.output
|
||||
path: "/world.txt"
|
||||
} & {
|
||||
// assert result
|
||||
contents: "world\n"
|
||||
}
|
||||
|
||||
verifyWorld: dagger.#ReadFile & {
|
||||
input: exec.output
|
||||
path: "/test.txt"
|
||||
} & {
|
||||
// assert result
|
||||
contents: "hello world"
|
||||
verifyWorld: dagger.#ReadFile & {
|
||||
input: exec.output
|
||||
path: "/test.txt"
|
||||
} & {
|
||||
// assert result
|
||||
contents: "hello world"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user