From aa74b8fb7b0eb7f41fad9183e220b9e37b91c6df Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Mon, 26 Apr 2021 17:42:48 -0700 Subject: [PATCH] added tests for push-container with login Signed-off-by: Sam Alba --- tests/ops.bats | 5 +++++ tests/ops/push-container/main.cue | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/tests/ops.bats b/tests/ops.bats index 39e23514..0bc7135e 100644 --- a/tests/ops.bats +++ b/tests/ops.bats @@ -84,6 +84,11 @@ setup() { @test "op.#PushContainer" { 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 assert_success } diff --git a/tests/ops/push-container/main.cue b/tests/ops/push-container/main.cue index e3930270..7129990f 100644 --- a/tests/ops/push-container/main.cue +++ b/tests/ops/push-container/main.cue @@ -1,10 +1,16 @@ package testing import ( + "dagger.io/dagger" "dagger.io/dagger/op" "dagger.io/alpine" ) +registry: { + username: string + secret: dagger.#Secret +} + TestPushContainer: { // Generate a random number random: { @@ -24,6 +30,9 @@ TestPushContainer: { push: { ref: "daggerio/ci-test:\(random)" #up: [ + op.#DockerLogin & { + registry + }, op.#WriteFile & { content: random dest: "/rand"