@@ -22,46 +22,46 @@ func TestClientSettingsPoliciesTargetRefKind(t *testing.T) {
22
22
name : "Validate TargetRef of kind Gateway is allowed" ,
23
23
policySpec : ngfAPIv1alpha1.ClientSettingsPolicySpec {
24
24
TargetRef : gatewayv1alpha2.LocalPolicyTargetReference {
25
- Kind : GatewayKind ,
26
- Group : GatewayGroup ,
25
+ Kind : gatewayKind ,
26
+ Group : gatewayGroup ,
27
27
},
28
28
},
29
29
},
30
30
{
31
31
name : "Validate TargetRef of kind HTTPRoute is allowed" ,
32
32
policySpec : ngfAPIv1alpha1.ClientSettingsPolicySpec {
33
33
TargetRef : gatewayv1alpha2.LocalPolicyTargetReference {
34
- Kind : HTTPRouteKind ,
35
- Group : GatewayGroup ,
34
+ Kind : httpRouteKind ,
35
+ Group : gatewayGroup ,
36
36
},
37
37
},
38
38
},
39
39
{
40
40
name : "Validate TargetRef of kind GRPCRoute is allowed" ,
41
41
policySpec : ngfAPIv1alpha1.ClientSettingsPolicySpec {
42
42
TargetRef : gatewayv1alpha2.LocalPolicyTargetReference {
43
- Kind : GRPCRouteKind ,
44
- Group : GatewayGroup ,
43
+ Kind : grpcRouteKind ,
44
+ Group : gatewayGroup ,
45
45
},
46
46
},
47
47
},
48
48
{
49
49
name : "Validate Invalid TargetRef Kind is not allowed" ,
50
- wantErrors : []string {ExpectedTargetRefKindError },
50
+ wantErrors : []string {expectedTargetRefKindError },
51
51
policySpec : ngfAPIv1alpha1.ClientSettingsPolicySpec {
52
52
TargetRef : gatewayv1alpha2.LocalPolicyTargetReference {
53
- Kind : InvalidKind ,
54
- Group : GatewayGroup ,
53
+ Kind : invalidKind ,
54
+ Group : gatewayGroup ,
55
55
},
56
56
},
57
57
},
58
58
{
59
59
name : "Validate TCPRoute TargetRef Kind is not allowed" ,
60
- wantErrors : []string {ExpectedTargetRefKindError },
60
+ wantErrors : []string {expectedTargetRefKindError },
61
61
policySpec : ngfAPIv1alpha1.ClientSettingsPolicySpec {
62
62
TargetRef : gatewayv1alpha2.LocalPolicyTargetReference {
63
- Kind : TCPRouteKind ,
64
- Group : GatewayGroup ,
63
+ Kind : tcpRouteKind ,
64
+ Group : gatewayGroup ,
65
65
},
66
66
},
67
67
},
@@ -86,28 +86,28 @@ func TestClientSettingsPoliciesTargetRefGroup(t *testing.T) {
86
86
name : "Validate gateway.networking.k8s.io TargetRef Group is allowed" ,
87
87
policySpec : ngfAPIv1alpha1.ClientSettingsPolicySpec {
88
88
TargetRef : gatewayv1alpha2.LocalPolicyTargetReference {
89
- Kind : GatewayKind ,
90
- Group : GatewayGroup ,
89
+ Kind : gatewayKind ,
90
+ Group : gatewayGroup ,
91
91
},
92
92
},
93
93
},
94
94
{
95
95
name : "Validate invalid.networking.k8s.io TargetRef Group is not allowed" ,
96
- wantErrors : []string {ExpectedTargetRefGroupError },
96
+ wantErrors : []string {expectedTargetRefGroupError },
97
97
policySpec : ngfAPIv1alpha1.ClientSettingsPolicySpec {
98
98
TargetRef : gatewayv1alpha2.LocalPolicyTargetReference {
99
- Kind : GatewayKind ,
100
- Group : InvalidGroup ,
99
+ Kind : gatewayKind ,
100
+ Group : invalidGroup ,
101
101
},
102
102
},
103
103
},
104
104
{
105
105
name : "Validate discovery.k8s.io/v1 TargetRef Group is not allowed" ,
106
- wantErrors : []string {ExpectedTargetRefGroupError },
106
+ wantErrors : []string {expectedTargetRefGroupError },
107
107
policySpec : ngfAPIv1alpha1.ClientSettingsPolicySpec {
108
108
TargetRef : gatewayv1alpha2.LocalPolicyTargetReference {
109
- Kind : GatewayKind ,
110
- Group : DiscoveryGroup ,
109
+ Kind : gatewayKind ,
110
+ Group : discoveryGroup ,
111
111
},
112
112
},
113
113
},
@@ -130,19 +130,19 @@ func validateClientSettingsPolicy(t *testing.T, tt struct {
130
130
t .Helper ()
131
131
g := NewWithT (t )
132
132
133
- k8sClient , err := GetKubernetesClient (t )
133
+ k8sClient , err := getKubernetesClient (t )
134
134
135
135
g .Expect (err ).ToNot (HaveOccurred ())
136
136
137
137
g .Expect (err ).ToNot (HaveOccurred ())
138
138
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 )
141
141
142
142
clientSettingsPolicy := & ngfAPIv1alpha1.ClientSettingsPolicy {
143
143
ObjectMeta : controllerruntime.ObjectMeta {
144
144
Name : policyName ,
145
- Namespace : "default" ,
145
+ Namespace : defaultNamespace ,
146
146
},
147
147
Spec : policySpec ,
148
148
}
0 commit comments