From 8d19782683ca3e0d1c5f27df7ffd591cfeaa6147 Mon Sep 17 00:00:00 2001 From: Matheus Pimenta Date: Tue, 16 Jul 2024 09:56:39 +0100 Subject: [PATCH] Improve invalid proxy error message for Bucket API Signed-off-by: Matheus Pimenta --- internal/controller/bucket_controller.go | 2 +- internal/controller/bucket_controller_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/controller/bucket_controller.go b/internal/controller/bucket_controller.go index 5d6ee25c..656e5d70 100644 --- a/internal/controller/bucket_controller.go +++ b/internal/controller/bucket_controller.go @@ -730,7 +730,7 @@ func (r *BucketReconciler) getProxyURL(ctx context.Context, obj *bucketv1.Bucket address, ok := proxyData["address"] if !ok { return nil, fmt.Errorf("invalid proxy secret '%s/%s': key 'address' is missing", - obj.Spec.ProxySecretRef.Name, namespace) + namespace, obj.Spec.ProxySecretRef.Name) } proxyURL, err := url.Parse(string(address)) if err != nil { diff --git a/internal/controller/bucket_controller_test.go b/internal/controller/bucket_controller_test.go index 51b1aae2..11c99613 100644 --- a/internal/controller/bucket_controller_test.go +++ b/internal/controller/bucket_controller_test.go @@ -589,7 +589,7 @@ func TestBucketReconciler_reconcileSource_generic(t *testing.T) { assertConditions: []metav1.Condition{ *conditions.TrueCondition(meta.ReconcilingCondition, meta.ProgressingReason, "foo"), *conditions.UnknownCondition(meta.ReadyCondition, "foo", "bar"), - *conditions.TrueCondition(sourcev1.FetchFailedCondition, sourcev1.AuthenticationFailedReason, "invalid proxy secret 'dummy/': key 'address' is missing"), + *conditions.TrueCondition(sourcev1.FetchFailedCondition, sourcev1.AuthenticationFailedReason, "invalid proxy secret '/dummy': key 'address' is missing"), }, }, { @@ -1622,7 +1622,7 @@ func TestBucketReconciler_getProxyURL(t *testing.T) { Data: map[string][]byte{}, }, }, - expectedErr: "invalid proxy secret 'dummy/': key 'address' is missing", + expectedErr: "invalid proxy secret '/dummy': key 'address' is missing", }, { name: "invalid address in proxySecretRef",