From 9dc58729e0603edeab7867432bcce3f65d2758eb Mon Sep 17 00:00:00 2001 From: Sanskar Jaiswal Date: Tue, 21 Nov 2023 15:21:35 +0530 Subject: [PATCH] helmrepo: add test for specifying only ca.crt Add test to assert that we support specifying only ca.crt in a generic Secret referred to by an OCI HelmRepository via `.spec.certSecretRef`. Signed-off-by: Sanskar Jaiswal --- .../helmrepository_controller_oci_test.go | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/internal/controller/helmrepository_controller_oci_test.go b/internal/controller/helmrepository_controller_oci_test.go index 2a33115c7..1884433b6 100644 --- a/internal/controller/helmrepository_controller_oci_test.go +++ b/internal/controller/helmrepository_controller_oci_test.go @@ -336,6 +336,36 @@ func TestHelmRepositoryOCIReconciler_authStrategy(t *testing.T) { { name: "HTTPS With CA cert", want: ctrl.Result{RequeueAfter: interval}, + registryOpts: registryOptions{ + withTLS: true, + }, + secretOpts: secretOptions{ + username: testRegistryUsername, + password: testRegistryPassword, + }, + secret: &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: "auth-secretref", + }, + Type: corev1.SecretTypeDockerConfigJson, + Data: map[string][]byte{}, + }, + certsSecret: &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: "certs-secretref", + }, + Type: corev1.SecretTypeOpaque, + Data: map[string][]byte{ + "ca.crt": tlsCA, + }, + }, + assertConditions: []metav1.Condition{ + *conditions.TrueCondition(meta.ReadyCondition, meta.SucceededReason, "Helm repository is ready"), + }, + }, + { + name: "HTTPS With CA cert and TLS auth", + want: ctrl.Result{RequeueAfter: interval}, registryOpts: registryOptions{ withTLS: true, withClientCertAuth: true,