From 67dbc94396688557e65f6fd3e46b3e01d87946c5 Mon Sep 17 00:00:00 2001 From: Ruixian Song Date: Wed, 27 Jul 2022 15:43:03 -0700 Subject: [PATCH] Update securityPolicy test cases --- pkg/backends/features/securitypolicy_test.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pkg/backends/features/securitypolicy_test.go b/pkg/backends/features/securitypolicy_test.go index 3c4448d6fc..bcc5958ba9 100644 --- a/pkg/backends/features/securitypolicy_test.go +++ b/pkg/backends/features/securitypolicy_test.go @@ -78,7 +78,7 @@ func TestEnsureSecurityPolicy(t *testing.T) { expectSetCall: true, }, { - desc: "remove-policy", + desc: "remove-policy-1", currentBackendService: &composite.BackendService{ Scope: meta.Global, SecurityPolicy: "https://www.googleapis.com/compute/projects/test-project/global/securityPolicies/policy-1", @@ -92,6 +92,15 @@ func TestEnsureSecurityPolicy(t *testing.T) { }, expectSetCall: true, }, + { + desc: "remove-policy-2", + currentBackendService: &composite.BackendService{ + Scope: meta.Global, + SecurityPolicy: "https://www.googleapis.com/compute/projects/test-project/global/securityPolicies/policy-1", + }, + desiredConfig: &backendconfigv1.BackendConfig{}, + expectSetCall: true, + }, { desc: "same-policy", currentBackendService: &composite.BackendService{ @@ -112,10 +121,10 @@ func TestEnsureSecurityPolicy(t *testing.T) { desiredConfig: &backendconfigv1.BackendConfig{}, }, { - desc: "no-specified-policy", + desc: "no-specified-policy-1", currentBackendService: &composite.BackendService{ Scope: meta.Global, - SecurityPolicy: "https://www.googleapis.com/compute/projects/test-project/global/securityPolicies/policy-1", + SecurityPolicy: "", }, desiredConfig: &backendconfigv1.BackendConfig{}, expectSetCall: false,