From e76838c925888f33895eb1db38251a82b884db2a Mon Sep 17 00:00:00 2001 From: stevenhorsman Date: Thu, 25 Jul 2024 16:51:13 +0100 Subject: [PATCH] tests/e2e: Add auth registry docker tests Run the authenticated regsitry tests for docker cloud provider Signed-off-by: stevenhorsman --- src/cloud-api-adaptor/test/e2e/docker_test.go | 19 +++++++++++++++++++ .../provisioner/docker/provision_common.go | 4 ++++ 2 files changed, 23 insertions(+) diff --git a/src/cloud-api-adaptor/test/e2e/docker_test.go b/src/cloud-api-adaptor/test/e2e/docker_test.go index 0438b451d..cd9a3b33e 100644 --- a/src/cloud-api-adaptor/test/e2e/docker_test.go +++ b/src/cloud-api-adaptor/test/e2e/docker_test.go @@ -6,6 +6,7 @@ package e2e import ( + "os" "testing" _ "github.com/confidential-containers/cloud-api-adaptor/src/cloud-api-adaptor/test/provisioner/docker" @@ -109,3 +110,21 @@ func TestDockerKbsKeyRelease(t *testing.T) { keyBrokerService.EnableKbsCustomizedResourcePolicy("allow_all.rego") DoTestKbsKeyRelease(t, testEnv, assert) } + +func TestDockerCreatePeerPodWithAuthenticatedImageWithoutCredentials(t *testing.T) { + assert := DockerAssert{} + if os.Getenv("AUTHENTICATED_REGISTRY_IMAGE") != "" { + DoTestCreatePeerPodWithAuthenticatedImageWithoutCredentials(t, testEnv, assert) + } else { + t.Skip("Authenticated Image Name not exported") + } +} + +func TestDockerCreatePeerPodWithAuthenticatedImageWithValidCredentials(t *testing.T) { + assert := DockerAssert{} + if os.Getenv("REGISTRY_CREDENTIAL_ENCODED") != "" && os.Getenv("AUTHENTICATED_REGISTRY_IMAGE") != "" { + DoTestCreatePeerPodWithAuthenticatedImageWithValidCredentials(t, testEnv, assert) + } else { + t.Skip("Registry Credentials, or authenticated image name not exported") + } +} diff --git a/src/cloud-api-adaptor/test/provisioner/docker/provision_common.go b/src/cloud-api-adaptor/test/provisioner/docker/provision_common.go index f715500f1..dda38fa87 100644 --- a/src/cloud-api-adaptor/test/provisioner/docker/provision_common.go +++ b/src/cloud-api-adaptor/test/provisioner/docker/provision_common.go @@ -257,6 +257,10 @@ func (lio *DockerInstallOverlay) Edit(ctx context.Context, cfg *envconf.Config, } } + if err := lio.Overlay.SetAuthJsonSecretIfApplicable(); err != nil { + return err + } + if err := lio.Overlay.YamlReload(); err != nil { return err }