From 14e9fa03c91cbf3dd75a1280b629f08641adf01f Mon Sep 17 00:00:00 2001 From: Matheus Pimenta Date: Wed, 4 Sep 2024 08:00:15 -0300 Subject: [PATCH] Rename test case field to follow pattern Signed-off-by: Matheus Pimenta --- .../imagerepository_controller_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/controller/imagerepository_controller_test.go b/internal/controller/imagerepository_controller_test.go index c8685ddf..331bddba 100644 --- a/internal/controller/imagerepository_controller_test.go +++ b/internal/controller/imagerepository_controller_test.go @@ -673,11 +673,11 @@ func TestImageRepositoryReconciler_scan(t *testing.T) { func TestImageRepositoryReconciler_getProxyURL(t *testing.T) { tests := []struct { - name string - repo *imagev1.ImageRepository - objects []client.Object - expectedURL string - expectedErr string + name string + repo *imagev1.ImageRepository + objects []client.Object + wantURL string + wantErr string }{ { name: "empty proxySecretRef", @@ -696,7 +696,7 @@ func TestImageRepositoryReconciler_getProxyURL(t *testing.T) { }, }, }, - expectedErr: "secrets \"non-existing\" not found", + wantErr: "secrets \"non-existing\" not found", }, { name: "missing address in proxySecretRef", @@ -715,7 +715,7 @@ func TestImageRepositoryReconciler_getProxyURL(t *testing.T) { Data: map[string][]byte{}, }, }, - expectedErr: "invalid proxy secret '/dummy': key 'address' is missing", + wantErr: "invalid proxy secret '/dummy': key 'address' is missing", }, { name: "invalid address in proxySecretRef", @@ -736,7 +736,7 @@ func TestImageRepositoryReconciler_getProxyURL(t *testing.T) { }, }, }, - expectedErr: "failed to parse proxy address '\x7f': parse \"\\x7f\": net/url: invalid control character in URL", + wantErr: "failed to parse proxy address '\x7f': parse \"\\x7f\": net/url: invalid control character in URL", }, { name: "no user, no password", @@ -757,7 +757,7 @@ func TestImageRepositoryReconciler_getProxyURL(t *testing.T) { }, }, }, - expectedURL: "http://proxy.example.com", + wantURL: "http://proxy.example.com", }, { name: "user, no password", @@ -779,7 +779,7 @@ func TestImageRepositoryReconciler_getProxyURL(t *testing.T) { }, }, }, - expectedURL: "http://user:@proxy.example.com", + wantURL: "http://user:@proxy.example.com", }, { name: "no user, password", @@ -801,7 +801,7 @@ func TestImageRepositoryReconciler_getProxyURL(t *testing.T) { }, }, }, - expectedURL: "http://:password@proxy.example.com", + wantURL: "http://:password@proxy.example.com", }, { name: "user, password", @@ -824,7 +824,7 @@ func TestImageRepositoryReconciler_getProxyURL(t *testing.T) { }, }, }, - expectedURL: "http://user:password@proxy.example.com", + wantURL: "http://user:password@proxy.example.com", }, } @@ -842,15 +842,15 @@ func TestImageRepositoryReconciler_getProxyURL(t *testing.T) { } u, err := r.getProxyURL(ctx, tt.repo) - if tt.expectedErr == "" { + if tt.wantErr == "" { g.Expect(err).To(BeNil()) } else { - g.Expect(err.Error()).To(ContainSubstring(tt.expectedErr)) + g.Expect(err.Error()).To(ContainSubstring(tt.wantErr)) } - if tt.expectedURL == "" { + if tt.wantURL == "" { g.Expect(u).To(BeNil()) } else { - g.Expect(u.String()).To(Equal(tt.expectedURL)) + g.Expect(u.String()).To(Equal(tt.wantURL)) } }) }