test: add push-container
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
9725b8de69
commit
9887166c71
56
tests/push-container/main.cue
Normal file
56
tests/push-container/main.cue
Normal file
@ -0,0 +1,56 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/alpine"
|
||||
)
|
||||
|
||||
TestPushContainer: {
|
||||
// Generate a random number
|
||||
random: {
|
||||
string
|
||||
#compute: [
|
||||
dagger.#Load & {from: alpine.#Image},
|
||||
dagger.#Exec & {
|
||||
args: ["sh", "-c", "echo -n $RANDOM > /rand"]
|
||||
},
|
||||
dagger.#Export & {
|
||||
source: "/rand"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
// Push an image with a random tag
|
||||
push: {
|
||||
ref: "daggerio/ci-test:\(random)"
|
||||
#compute: [
|
||||
dagger.#WriteFile & {
|
||||
content: random
|
||||
dest: "/rand"
|
||||
},
|
||||
dagger.#PushContainer & {
|
||||
"ref": ref
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
// Pull the image back
|
||||
pull: #compute: [
|
||||
dagger.#FetchContainer & {
|
||||
ref: push.ref
|
||||
},
|
||||
]
|
||||
|
||||
// Check the content
|
||||
check: #compute: [
|
||||
dagger.#Load & {from: alpine.#Image},
|
||||
dagger.#Exec & {
|
||||
args: [
|
||||
"sh", "-c", #"""
|
||||
test "$(cat /src/rand)" = "\#(random)"
|
||||
"""#,
|
||||
]
|
||||
mount: "/src": from: pull
|
||||
},
|
||||
]
|
||||
}
|
@ -94,9 +94,8 @@ test::fetchcontainer(){
|
||||
test::pushcontainer(){
|
||||
local dagger="$1"
|
||||
|
||||
# Fetch container
|
||||
secret test::one "FetchContainer: valid containers" --exit=0 \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/fetch-container/exist
|
||||
secret test::one "PushContainer: simple" --exit=0 \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/push-container
|
||||
}
|
||||
|
||||
test::fetchgit(){
|
||||
@ -214,7 +213,6 @@ test::local(){
|
||||
disable "" "There are no local tests right now (the feature is possibly not functioning at all: see https://github.com/blocklayerhq/dagger/issues/41)"
|
||||
}
|
||||
|
||||
|
||||
test::mount(){
|
||||
test::one "Mount: tmpfs" --exit=0 \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/mounts/valid/tmpfs
|
||||
@ -257,23 +255,23 @@ test::dockerbuild() {
|
||||
test::all(){
|
||||
local dagger="$1"
|
||||
|
||||
# test::load "$dagger"
|
||||
# test::mount "$dagger"
|
||||
test::load "$dagger"
|
||||
test::mount "$dagger"
|
||||
|
||||
# test::copy "$dagger"
|
||||
# test::local "$dagger"
|
||||
# test::compute "$dagger"
|
||||
# test::fetchcontainer "$dagger"
|
||||
test::copy "$dagger"
|
||||
test::local "$dagger"
|
||||
test::compute "$dagger"
|
||||
test::fetchcontainer "$dagger"
|
||||
test::pushcontainer "$dagger"
|
||||
# test::fetchgit "$dagger"
|
||||
# test::exec "$dagger"
|
||||
# test::export "$dagger"
|
||||
# test::input "$dagger"
|
||||
# test::subdir "$dagger"
|
||||
# test::dockerbuild "$dagger"
|
||||
test::fetchgit "$dagger"
|
||||
test::exec "$dagger"
|
||||
test::export "$dagger"
|
||||
test::input "$dagger"
|
||||
test::subdir "$dagger"
|
||||
test::dockerbuild "$dagger"
|
||||
|
||||
# test::stdlib "$dagger"
|
||||
# test::examples "$dagger"
|
||||
test::stdlib "$dagger"
|
||||
test::examples "$dagger"
|
||||
}
|
||||
|
||||
case "${1:-all}" in
|
||||
|
Reference in New Issue
Block a user