Skip to content

Commit

Permalink
adjust TestILBError to tolerate NEG defaulting
Browse files Browse the repository at this point in the history
  • Loading branch information
freehan committed May 12, 2020
1 parent fdbb955 commit 2754ff9
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion cmd/e2e-test/ilb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,10 +498,34 @@ func TestILBError(t *testing.T) {
}
t.Logf("Ingress created (%s/%s)", s.Namespace, tc.ing.Name)

// Retrieve service NEG annotation
// TODO(freehan): remove this once NEG is default for all qualified cluster versions
svc, err := Framework.Clientset.CoreV1().Services(s.Namespace).Get(context.TODO(), serviceName, metav1.GetOptions{})
if err != nil {
t.Fatalf("expect err = nil, but got %v", err)
}
svcAnnotation := annotations.FromService(svc)
negAnnotation, ok, err := svcAnnotation.NEGAnnotation()
if err != nil {
t.Fatalf("expect err = nil, but got %v", err)
}

// Proceed with error expectation according to NEG annotation
// TODO(freehan): remove this once NEG is default for all qualified cluster versions
expectError := true
if ok && negAnnotation.Ingress {
expectError = false
}

_, err = e2e.WaitForIngress(s, tc.ing, nil)
if err == nil {

if expectError && err == nil {
t.Fatalf("want err, got nil")
}

if !expectError && err != nil {
t.Fatalf("want err nil, got err %v", err)
}
})
}
}
Expand Down

0 comments on commit 2754ff9

Please sign in to comment.