added tests for push-container with login

Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
Sam Alba 2021-04-26 17:42:48 -07:00
parent ea43129a1f
commit aa74b8fb7b
2 changed files with 14 additions and 0 deletions

View File

@ -84,6 +84,11 @@ setup() {
@test "op.#PushContainer" { @test "op.#PushContainer" {
skip_unless_secrets_available "$TESTDIR"/ops/push-container/inputs.yaml skip_unless_secrets_available "$TESTDIR"/ops/push-container/inputs.yaml
# ensure the tests fail without credentials
run "$DAGGER" compute "$TESTDIR"/ops/push-container/valid
assert_failure
# check that they succeed with the credentials
run "$DAGGER" compute --input-yaml "$TESTDIR"/ops/push-container/inputs.yaml "$TESTDIR"/ops/push-container run "$DAGGER" compute --input-yaml "$TESTDIR"/ops/push-container/inputs.yaml "$TESTDIR"/ops/push-container
assert_success assert_success
} }

View File

@ -1,10 +1,16 @@
package testing package testing
import ( import (
"dagger.io/dagger"
"dagger.io/dagger/op" "dagger.io/dagger/op"
"dagger.io/alpine" "dagger.io/alpine"
) )
registry: {
username: string
secret: dagger.#Secret
}
TestPushContainer: { TestPushContainer: {
// Generate a random number // Generate a random number
random: { random: {
@ -24,6 +30,9 @@ TestPushContainer: {
push: { push: {
ref: "daggerio/ci-test:\(random)" ref: "daggerio/ci-test:\(random)"
#up: [ #up: [
op.#DockerLogin & {
registry
},
op.#WriteFile & { op.#WriteFile & {
content: random content: random
dest: "/rand" dest: "/rand"