Skip to content

Commit 37da93e

Browse files
committed
Additional test cases with different groups and kinds for BackendTLSPolicy CEL validation
Signed-off-by: Norwin Schnyder <[email protected]>
1 parent 3674f33 commit 37da93e

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

pkg/test/cel/backendtlspolicy_test.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,44 @@ func TestBackendTLSPolicyTargetRefs(t *testing.T) {
153153
SectionName: ptrTo(gatewayv1a2.SectionName("foo")),
154154
}},
155155
},
156+
{
157+
name: "valid because duplicate target refs with different kinds",
158+
wantErrors: []string{},
159+
targetRefs: []gatewayv1a2.LocalPolicyTargetReferenceWithSectionName{{
160+
LocalPolicyTargetReference: gatewayv1a2.LocalPolicyTargetReference{
161+
Group: gatewayv1a2.Group(corev1.GroupName),
162+
Kind: gatewayv1a2.Kind("Service"),
163+
Name: "example",
164+
},
165+
SectionName: ptrTo(gatewayv1a2.SectionName("foo")),
166+
}, {
167+
LocalPolicyTargetReference: gatewayv1a2.LocalPolicyTargetReference{
168+
Group: gatewayv1a2.Group(corev1.GroupName),
169+
Kind: gatewayv1a2.Kind("NotService"),
170+
Name: "example",
171+
},
172+
SectionName: ptrTo(gatewayv1a2.SectionName("foo")),
173+
}},
174+
},
175+
{
176+
name: "valid because duplicate target refs with different groups",
177+
wantErrors: []string{},
178+
targetRefs: []gatewayv1a2.LocalPolicyTargetReferenceWithSectionName{{
179+
LocalPolicyTargetReference: gatewayv1a2.LocalPolicyTargetReference{
180+
Group: gatewayv1a2.Group(corev1.GroupName),
181+
Kind: gatewayv1a2.Kind("Service"),
182+
Name: "example",
183+
},
184+
SectionName: ptrTo(gatewayv1a2.SectionName("foo")),
185+
}, {
186+
LocalPolicyTargetReference: gatewayv1a2.LocalPolicyTargetReference{
187+
Group: gatewayv1a2.Group("svc.other.io"),
188+
Kind: gatewayv1a2.Kind("Service"),
189+
Name: "example",
190+
},
191+
SectionName: ptrTo(gatewayv1a2.SectionName("foo")),
192+
}},
193+
},
156194
}
157195
for _, tc := range tests {
158196
t.Run(tc.name, func(t *testing.T) {

0 commit comments

Comments
 (0)