Skip to content

Commit

Permalink
Rename test case field to follow pattern
Browse files Browse the repository at this point in the history
Signed-off-by: Matheus Pimenta <[email protected]>
  • Loading branch information
matheuscscp committed Sep 4, 2024
1 parent c373be7 commit 14e9fa0
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions internal/controller/imagerepository_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -757,7 +757,7 @@ func TestImageRepositoryReconciler_getProxyURL(t *testing.T) {
},
},
},
expectedURL: "http://proxy.example.com",
wantURL: "http://proxy.example.com",
},
{
name: "user, no password",
Expand All @@ -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",
Expand All @@ -801,7 +801,7 @@ func TestImageRepositoryReconciler_getProxyURL(t *testing.T) {
},
},
},
expectedURL: "http://:[email protected]",
wantURL: "http://:[email protected]",
},
{
name: "user, password",
Expand All @@ -824,7 +824,7 @@ func TestImageRepositoryReconciler_getProxyURL(t *testing.T) {
},
},
},
expectedURL: "http://user:[email protected]",
wantURL: "http://user:[email protected]",
},
}

Expand All @@ -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))
}
})
}
Expand Down

0 comments on commit 14e9fa0

Please sign in to comment.