@@ -153,6 +153,44 @@ func TestBackendTLSPolicyTargetRefs(t *testing.T) {
153
153
SectionName : ptrTo (gatewayv1a2 .SectionName ("foo" )),
154
154
}},
155
155
},
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
+ },
156
194
}
157
195
for _ , tc := range tests {
158
196
t .Run (tc .name , func (t * testing.T ) {
0 commit comments