From 01e64deed4480d708f1b4bb5af37d4e7b093578b Mon Sep 17 00:00:00 2001 From: zirain Date: Sun, 26 May 2024 15:16:56 +0800 Subject: [PATCH] fix test Signed-off-by: zirain --- .../provider/kubernetes/predicates_test.go | 39 ++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/internal/provider/kubernetes/predicates_test.go b/internal/provider/kubernetes/predicates_test.go index 22f527b77ec..c7b6054e504 100644 --- a/internal/provider/kubernetes/predicates_test.go +++ b/internal/provider/kubernetes/predicates_test.go @@ -595,8 +595,12 @@ func TestValidateServiceForReconcile(t *testing.T) { }, ExtAuth: &v1alpha1.ExtAuth{ HTTP: &v1alpha1.HTTPExtAuthService{ - BackendRef: &gwapiv1.BackendObjectReference{ - Name: "ext-auth-http-service", + BackendRefs: []v1alpha1.BackendRef{ + { + BackendObjectReference: gwapiv1.BackendObjectReference{ + Name: "ext-auth-http-service", + }, + }, }, }, }, @@ -606,6 +610,37 @@ func TestValidateServiceForReconcile(t *testing.T) { service: test.GetService(types.NamespacedName{Name: "ext-auth-http-service"}, nil, nil), expect: true, }, + { + name: "service referenced by SecurityPolicy ExtAuth GRPC service", + configs: []client.Object{ + &v1alpha1.SecurityPolicy{ + ObjectMeta: metav1.ObjectMeta{ + Name: "ext-auth-http", + }, + Spec: v1alpha1.SecurityPolicySpec{ + TargetRef: gwapiv1a2.LocalPolicyTargetReferenceWithSectionName{ + LocalPolicyTargetReference: gwapiv1a2.LocalPolicyTargetReference{ + Kind: "Gateway", + Name: "scheduled-status-test", + }, + }, + ExtAuth: &v1alpha1.ExtAuth{ + GRPC: &v1alpha1.GRPCExtAuthService{ + BackendRefs: []v1alpha1.BackendRef{ + { + BackendObjectReference: gwapiv1.BackendObjectReference{ + Name: "ext-auth-grpc-service", + }, + }, + }, + }, + }, + }, + }, + }, + service: test.GetService(types.NamespacedName{Name: "ext-auth-grpc-service"}, nil, nil), + expect: true, + }, { name: "service referenced by EnvoyExtensionPolicy ExtPrc GRPC service", configs: []client.Object{