tests: move llb tests into tests/llb

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi
2021-03-31 18:49:53 -07:00
parent e0afc6304d
commit 93296fa358
62 changed files with 59 additions and 71 deletions

View File

@@ -0,0 +1,56 @@
package main
import (
"dagger.io/llb"
"dagger.io/alpine"
)
TestPushContainer: {
// Generate a random number
random: {
string
#compute: [
llb.#Load & {from: alpine.#Image},
llb.#Exec & {
args: ["sh", "-c", "echo -n $RANDOM > /rand"]
},
llb.#Export & {
source: "/rand"
},
]
}
// Push an image with a random tag
push: {
ref: "daggerio/ci-test:\(random)"
#compute: [
llb.#WriteFile & {
content: random
dest: "/rand"
},
llb.#PushContainer & {
"ref": ref
},
]
}
// Pull the image back
pull: #compute: [
llb.#FetchContainer & {
ref: push.ref
},
]
// Check the content
check: #compute: [
llb.#Load & {from: alpine.#Image},
llb.#Exec & {
args: [
"sh", "-c", #"""
test "$(cat /src/rand)" = "\#(random)"
"""#,
]
mount: "/src": from: pull
},
]
}