Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
Add test coverage for changes to service resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
nathancoleman committed Jul 19, 2022
1 parent fd79e76 commit f19a977
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions internal/k8s/service/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ func TestResolutionErrors_Add(t *testing.T) {

r.Add(NewInvalidKindError("invalidkind error"))
assert.Equal(t, getLengthAtErrorType(r, InvalidKindErrorType), 1)

r.Add(NewBackendNotFoundError("backendnotfound error"))
assert.Equal(t, getLengthAtErrorType(r, BackendNotFoundErrorType), 1)
}

func TestResolutionErrors_Flatten(t *testing.T) {
Expand Down Expand Up @@ -69,6 +72,18 @@ func TestResolutionErrors_Flatten(t *testing.T) {
},
},
},
{
name: "backendnotfound error",
want: BackendNotFoundErrorType,
wantErr: true,
fields: fields{
errors: map[ServiceResolutionErrorType][]ResolutionError{
BackendNotFoundErrorType: {
NewBackendNotFoundError("expected"),
},
},
},
},
{
name: "generic error",
want: GenericResolutionErrorType,
Expand Down Expand Up @@ -159,6 +174,17 @@ func TestResolutionErrors_Empty(t *testing.T) {
},
},
},
{
name: "backendnotfound error",
want: false,
fields: fields{
errors: map[ServiceResolutionErrorType][]ResolutionError{
BackendNotFoundErrorType: {
NewBackendNotFoundError("expected"),
},
},
},
},
{
name: "generic error",
want: false,
Expand Down

0 comments on commit f19a977

Please sign in to comment.