@@ -266,6 +266,91 @@ var _ = DescribeTable("Basic GatewayTranslator Tests",
266
266
Name : "example-tcp-gateway" ,
267
267
},
268
268
}),
269
+ Entry (
270
+ "tls gateway with basic routing" ,
271
+ translatorTestCase {
272
+ inputFile : "tls-routing/basic.yaml" ,
273
+ outputFile : "tls-routing/basic-proxy.yaml" ,
274
+ gwNN : types.NamespacedName {
275
+ Namespace : "default" ,
276
+ Name : "example-gateway" ,
277
+ },
278
+ assertReports : func (gwNN types.NamespacedName , reportsMap reports.ReportMap ) {
279
+ route := & gwv1a2.TLSRoute {
280
+ ObjectMeta : metav1.ObjectMeta {
281
+ Name : "example-tls-route" ,
282
+ Namespace : "default" ,
283
+ },
284
+ }
285
+ routeStatus := reportsMap .BuildRouteStatus (context .TODO (), route , "" )
286
+ Expect (routeStatus ).NotTo (BeNil ())
287
+ Expect (routeStatus .Parents ).To (HaveLen (1 ))
288
+ resolvedRefs := meta .FindStatusCondition (routeStatus .Parents [0 ].Conditions , string (gwv1 .RouteConditionResolvedRefs ))
289
+ Expect (resolvedRefs ).NotTo (BeNil ())
290
+ Expect (resolvedRefs .Status ).To (Equal (metav1 .ConditionTrue ))
291
+ Expect (resolvedRefs .Reason ).To (Equal (string (gwv1 .RouteReasonResolvedRefs )))
292
+ },
293
+ }),
294
+ Entry (
295
+ "tlsroute with missing backend reports correctly" ,
296
+ translatorTestCase {
297
+ inputFile : "tls-routing/missing-backend.yaml" ,
298
+ outputFile : "tls-routing/missing-backend.yaml" ,
299
+ gwNN : types.NamespacedName {
300
+ Namespace : "default" ,
301
+ Name : "example-gateway" ,
302
+ },
303
+ assertReports : func (gwNN types.NamespacedName , reportsMap reports.ReportMap ) {
304
+ route := & gwv1a2.TLSRoute {
305
+ ObjectMeta : metav1.ObjectMeta {
306
+ Name : "example-tls-route" ,
307
+ Namespace : "default" ,
308
+ },
309
+ }
310
+ routeStatus := reportsMap .BuildRouteStatus (context .TODO (), route , "" )
311
+ Expect (routeStatus ).NotTo (BeNil ())
312
+ Expect (routeStatus .Parents ).To (HaveLen (1 ))
313
+ resolvedRefs := meta .FindStatusCondition (routeStatus .Parents [0 ].Conditions , string (gwv1 .RouteConditionResolvedRefs ))
314
+ Expect (resolvedRefs ).NotTo (BeNil ())
315
+ Expect (resolvedRefs .Status ).To (Equal (metav1 .ConditionFalse ))
316
+ Expect (resolvedRefs .Message ).To (Equal ("services \" example-tls-svc\" not found" ))
317
+ },
318
+ }),
319
+ Entry (
320
+ "tlsroute with invalid backend reports correctly" ,
321
+ translatorTestCase {
322
+ inputFile : "tls-routing/invalid-backend.yaml" ,
323
+ outputFile : "tls-routing/invalid-backend.yaml" ,
324
+ gwNN : types.NamespacedName {
325
+ Namespace : "default" ,
326
+ Name : "example-gateway" ,
327
+ },
328
+ assertReports : func (gwNN types.NamespacedName , reportsMap reports.ReportMap ) {
329
+ route := & gwv1a2.TLSRoute {
330
+ ObjectMeta : metav1.ObjectMeta {
331
+ Name : "example-tls-route" ,
332
+ Namespace : "default" ,
333
+ },
334
+ }
335
+ routeStatus := reportsMap .BuildRouteStatus (context .TODO (), route , "" )
336
+ Expect (routeStatus ).NotTo (BeNil ())
337
+ Expect (routeStatus .Parents ).To (HaveLen (1 ))
338
+ resolvedRefs := meta .FindStatusCondition (routeStatus .Parents [0 ].Conditions , string (gwv1 .RouteConditionResolvedRefs ))
339
+ Expect (resolvedRefs ).NotTo (BeNil ())
340
+ Expect (resolvedRefs .Status ).To (Equal (metav1 .ConditionFalse ))
341
+ Expect (resolvedRefs .Message ).To (Equal ("unknown backend kind" ))
342
+ },
343
+ }),
344
+ Entry (
345
+ "tls gateway with multiple backend services" ,
346
+ translatorTestCase {
347
+ inputFile : "tls-routing/multi-backend.yaml" ,
348
+ outputFile : "tls-routing/multi-backend-proxy.yaml" ,
349
+ gwNN : types.NamespacedName {
350
+ Namespace : "default" ,
351
+ Name : "example-gateway" ,
352
+ },
353
+ }),
269
354
Entry ("Plugin Backend" , translatorTestCase {
270
355
inputFile : "backend-plugin/gateway.yaml" ,
271
356
outputFile : "backend-plugin-proxy.yaml" ,
0 commit comments