@@ -22,46 +22,46 @@ func TestClientSettingsPoliciesTargetRefKind(t *testing.T) {
2222 name : "Validate TargetRef of kind Gateway is allowed" ,
2323 policySpec : ngfAPIv1alpha1.ClientSettingsPolicySpec {
2424 TargetRef : gatewayv1alpha2.LocalPolicyTargetReference {
25- Kind : GatewayKind ,
26- Group : GatewayGroup ,
25+ Kind : gatewayKind ,
26+ Group : gatewayGroup ,
2727 },
2828 },
2929 },
3030 {
3131 name : "Validate TargetRef of kind HTTPRoute is allowed" ,
3232 policySpec : ngfAPIv1alpha1.ClientSettingsPolicySpec {
3333 TargetRef : gatewayv1alpha2.LocalPolicyTargetReference {
34- Kind : HTTPRouteKind ,
35- Group : GatewayGroup ,
34+ Kind : httpRouteKind ,
35+ Group : gatewayGroup ,
3636 },
3737 },
3838 },
3939 {
4040 name : "Validate TargetRef of kind GRPCRoute is allowed" ,
4141 policySpec : ngfAPIv1alpha1.ClientSettingsPolicySpec {
4242 TargetRef : gatewayv1alpha2.LocalPolicyTargetReference {
43- Kind : GRPCRouteKind ,
44- Group : GatewayGroup ,
43+ Kind : grpcRouteKind ,
44+ Group : gatewayGroup ,
4545 },
4646 },
4747 },
4848 {
4949 name : "Validate Invalid TargetRef Kind is not allowed" ,
50- wantErrors : []string {ExpectedTargetRefKindError },
50+ wantErrors : []string {expectedTargetRefKindError },
5151 policySpec : ngfAPIv1alpha1.ClientSettingsPolicySpec {
5252 TargetRef : gatewayv1alpha2.LocalPolicyTargetReference {
53- Kind : InvalidKind ,
54- Group : GatewayGroup ,
53+ Kind : invalidKind ,
54+ Group : gatewayGroup ,
5555 },
5656 },
5757 },
5858 {
5959 name : "Validate TCPRoute TargetRef Kind is not allowed" ,
60- wantErrors : []string {ExpectedTargetRefKindError },
60+ wantErrors : []string {expectedTargetRefKindError },
6161 policySpec : ngfAPIv1alpha1.ClientSettingsPolicySpec {
6262 TargetRef : gatewayv1alpha2.LocalPolicyTargetReference {
63- Kind : TCPRouteKind ,
64- Group : GatewayGroup ,
63+ Kind : tcpRouteKind ,
64+ Group : gatewayGroup ,
6565 },
6666 },
6767 },
@@ -86,28 +86,28 @@ func TestClientSettingsPoliciesTargetRefGroup(t *testing.T) {
8686 name : "Validate gateway.networking.k8s.io TargetRef Group is allowed" ,
8787 policySpec : ngfAPIv1alpha1.ClientSettingsPolicySpec {
8888 TargetRef : gatewayv1alpha2.LocalPolicyTargetReference {
89- Kind : GatewayKind ,
90- Group : GatewayGroup ,
89+ Kind : gatewayKind ,
90+ Group : gatewayGroup ,
9191 },
9292 },
9393 },
9494 {
9595 name : "Validate invalid.networking.k8s.io TargetRef Group is not allowed" ,
96- wantErrors : []string {ExpectedTargetRefGroupError },
96+ wantErrors : []string {expectedTargetRefGroupError },
9797 policySpec : ngfAPIv1alpha1.ClientSettingsPolicySpec {
9898 TargetRef : gatewayv1alpha2.LocalPolicyTargetReference {
99- Kind : GatewayKind ,
100- Group : InvalidGroup ,
99+ Kind : gatewayKind ,
100+ Group : invalidGroup ,
101101 },
102102 },
103103 },
104104 {
105105 name : "Validate discovery.k8s.io/v1 TargetRef Group is not allowed" ,
106- wantErrors : []string {ExpectedTargetRefGroupError },
106+ wantErrors : []string {expectedTargetRefGroupError },
107107 policySpec : ngfAPIv1alpha1.ClientSettingsPolicySpec {
108108 TargetRef : gatewayv1alpha2.LocalPolicyTargetReference {
109- Kind : GatewayKind ,
110- Group : DiscoveryGroup ,
109+ Kind : gatewayKind ,
110+ Group : discoveryGroup ,
111111 },
112112 },
113113 },
@@ -130,19 +130,19 @@ func validateClientSettingsPolicy(t *testing.T, tt struct {
130130 t .Helper ()
131131 g := NewWithT (t )
132132
133- k8sClient , err := GetKubernetesClient (t )
133+ k8sClient , err := getKubernetesClient (t )
134134
135135 g .Expect (err ).ToNot (HaveOccurred ())
136136
137137 g .Expect (err ).ToNot (HaveOccurred ())
138138 policySpec := tt .policySpec
139- policySpec .TargetRef .Name = gatewayv1alpha2 .ObjectName (UniqueResourceName (TargetRef ))
140- policyName := UniqueResourceName (PolicyName )
139+ policySpec .TargetRef .Name = gatewayv1alpha2 .ObjectName (UniqueResourceName (testTargetRefName ))
140+ policyName := UniqueResourceName (testPolicyName )
141141
142142 clientSettingsPolicy := & ngfAPIv1alpha1.ClientSettingsPolicy {
143143 ObjectMeta : controllerruntime.ObjectMeta {
144144 Name : policyName ,
145- Namespace : "default" ,
145+ Namespace : defaultNamespace ,
146146 },
147147 Spec : policySpec ,
148148 }
0 commit comments