Skip to content

Commit

Permalink
test: strengthen parser getEndpoints() test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
larribas committed Jul 24, 2021
1 parent 3c0081e commit f1f963a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pkg/parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3706,6 +3706,7 @@ func TestGetEndpoints(t *testing.T) {
},
&corev1.ServicePort{
Name: "default",
Port: 80,
TargetPort: intstr.FromInt(2080),
},
corev1.ProtocolTCP,
Expand All @@ -3716,12 +3717,12 @@ func TestGetEndpoints(t *testing.T) {
[]util.Endpoint{
{
Address: "foo.bar.svc",
Port: "2080",
Port: "80",
},
},
},
{
"when serviceUpstream is set to true in the IngressClassParameters, the service should return one endpoint",
"when serviceUpstream is set to true in the IngressClassParameters",
&corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
Expand All @@ -3739,6 +3740,7 @@ func TestGetEndpoints(t *testing.T) {
},
&corev1.ServicePort{
Name: "default",
Port: 80,
TargetPort: intstr.FromInt(2080),
},
corev1.ProtocolTCP,
Expand All @@ -3751,7 +3753,7 @@ func TestGetEndpoints(t *testing.T) {
[]util.Endpoint{
{
Address: "foo.bar.svc",
Port: "2080",
Port: "80",
},
},
},
Expand Down Expand Up @@ -4019,6 +4021,12 @@ func TestGetEndpoints(t *testing.T) {
if len(testCase.result) != len(result) {
t.Errorf("expected %v Endpoints but got %v", testCase.result, len(result))
}

for i := range result {
if result[i] != testCase.result[i] {
t.Errorf("expected %v to be equal to %v", result[i], testCase.result[i])
}
}
})
}
}
Expand Down

0 comments on commit f1f963a

Please sign in to comment.