From b3085207ee66813d2d86e76ab9e4ab4e499c51ae Mon Sep 17 00:00:00 2001 From: Rohit Ramkumar Date: Tue, 23 Oct 2018 12:00:23 -0700 Subject: [PATCH] In e2e tests, always skip checking for deletion of default backend service --- cmd/e2e-test/basic_test.go | 5 ++++- cmd/e2e-test/cdn_test.go | 6 +++++- cmd/e2e-test/iap_test.go | 6 +++++- cmd/e2e-test/security_policy_test.go | 8 ++++++-- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/cmd/e2e-test/basic_test.go b/cmd/e2e-test/basic_test.go index 5c8d986120..83c96071f9 100644 --- a/cmd/e2e-test/basic_test.go +++ b/cmd/e2e-test/basic_test.go @@ -109,7 +109,10 @@ func TestBasic(t *testing.T) { t.Errorf("got %d backend services, want %d;\n%s", len(gclb.BackendService), tc.numBackendServices, pretty.Sprint(gclb.BackendService)) } - if err := e2e.WaitForIngressDeletion(ctx, gclb, s, ing, nil); err != nil { + deleteOptions := &fuzz.GCLBDeleteOptions{ + SkipDefaultBackend: true, + } + if err := e2e.WaitForIngressDeletion(ctx, gclb, s, ing, deleteOptions); err != nil { t.Errorf("e2e.WaitForIngressDeletion(..., %q, nil) = %v, want nil", ing.Name, err) } }) diff --git a/cmd/e2e-test/cdn_test.go b/cmd/e2e-test/cdn_test.go index 0de9e8f0db..4954d1bc7c 100644 --- a/cmd/e2e-test/cdn_test.go +++ b/cmd/e2e-test/cdn_test.go @@ -117,8 +117,12 @@ func TestCDN(t *testing.T) { if err := Framework.Clientset.Extensions().Ingresses(s.Namespace).Delete(ing.Name, &metav1.DeleteOptions{}); err != nil { t.Errorf("Delete(%q) = %v, want nil", ing.Name, err) } + + deleteOptions := &fuzz.GCLBDeleteOptions{ + SkipDefaultBackend: true, + } t.Logf("Waiting for GCLB resources to be deleted (%s/%s)", s.Namespace, ing.Name) - if err := e2e.WaitForGCLBDeletion(ctx, Framework.Cloud, gclb, nil); err != nil { + if err := e2e.WaitForGCLBDeletion(ctx, Framework.Cloud, gclb, deleteOptions); err != nil { t.Errorf("e2e.WaitForGCLBDeletion(...) = %v, want nil", err) } t.Logf("GCLB resources deleted (%s/%s)", s.Namespace, ing.Name) diff --git a/cmd/e2e-test/iap_test.go b/cmd/e2e-test/iap_test.go index f8def24d96..496c55e596 100644 --- a/cmd/e2e-test/iap_test.go +++ b/cmd/e2e-test/iap_test.go @@ -94,8 +94,12 @@ func TestIAP(t *testing.T) { if err := Framework.Clientset.Extensions().Ingresses(s.Namespace).Delete(ing.Name, &metav1.DeleteOptions{}); err != nil { t.Errorf("Delete(%q) = %v, want nil", ing.Name, err) } + + deleteOptions := &fuzz.GCLBDeleteOptions{ + SkipDefaultBackend: true, + } t.Logf("Waiting for GCLB resources to be deleted (%s/%s)", s.Namespace, ing.Name) - if err := e2e.WaitForGCLBDeletion(ctx, Framework.Cloud, gclb, nil); err != nil { + if err := e2e.WaitForGCLBDeletion(ctx, Framework.Cloud, gclb, deleteOptions); err != nil { t.Errorf("e2e.WaitForGCLBDeletion(...) = %v, want nil", err) } t.Logf("GCLB resources deleted (%s/%s)", s.Namespace, ing.Name) diff --git a/cmd/e2e-test/security_policy_test.go b/cmd/e2e-test/security_policy_test.go index 9fa8e58c35..4a931d9da9 100644 --- a/cmd/e2e-test/security_policy_test.go +++ b/cmd/e2e-test/security_policy_test.go @@ -42,6 +42,10 @@ const ( policyUpdateTimeout = 10 * time.Minute ) +var deleteOptions = &fuzz.GCLBDeleteOptions{ + SkipDefaultBackend: true, +} + func buildPolicyAllowAll(name string) *computebeta.SecurityPolicy { return &computebeta.SecurityPolicy{ Name: name, @@ -131,7 +135,7 @@ func TestSecurityPolicyEnable(t *testing.T) { t.Logf("Cleaning up test") - if err := e2e.WaitForIngressDeletion(ctx, gclb, s, testIng, nil); err != nil { + if err := e2e.WaitForIngressDeletion(ctx, gclb, s, testIng, deleteOptions); err != nil { t.Errorf("e2e.WaitForIngressDeletion(..., %q, nil) = %v, want nil", testIng.Name, err) } }) @@ -236,7 +240,7 @@ func TestSecurityPolicyTransition(t *testing.T) { t.Logf("Cleaning up test") - if err := e2e.WaitForIngressDeletion(ctx, gclb, s, ing, nil); err != nil { + if err := e2e.WaitForIngressDeletion(ctx, gclb, s, ing, deleteOptions); err != nil { t.Errorf("e2e.WaitForIngressDeletion(..., %q, nil) = %v, want nil", ing.Name, err) } })