@@ -365,6 +365,67 @@ func TestReconcileTLS(t *testing.T) {
365
365
ktesting .Eventf (corev1 .EventTypeNormal , "Created" , "Created HTTPRoute \" example.com\" " ),
366
366
ktesting .Eventf (corev1 .EventTypeNormal , "Created" , "Created redirect HTTPRoute \" example.com-redirect\" " ),
367
367
},
368
+ }, {
369
+ Name : "Cluster local TLS ingress with httpOption redirected" ,
370
+ Key : "ns/name" ,
371
+ Objects : append ([]runtime.Object {
372
+ ing (withInternalSpec , withGatewayAPIClass , withHTTPOptionRedirected , withTLS ()),
373
+ secret (secretName , nsName ),
374
+ gw (defaultListener ),
375
+ }, servicesAndEndpoints ... ),
376
+ WantCreates : []runtime.Object {
377
+ httpRoute (t , ing (withInternalSpec , withGatewayAPIClass , withHTTPOptionRedirected , withTLS ())),
378
+ },
379
+ WantStatusUpdates : []clientgotesting.UpdateActionImpl {{
380
+ Object : ing (withInternalSpec , withGatewayAPIClass , withHTTPOptionRedirected , withTLS (), func (i * v1alpha1.Ingress ) {
381
+ // These are the things we expect to change in status.
382
+ i .Status .InitializeConditions ()
383
+ i .Status .MarkIngressNotReady ("HTTPRouteNotReady" , "Waiting for HTTPRoute becomes Ready." )
384
+ i .Status .MarkLoadBalancerNotReady ()
385
+ }),
386
+ }},
387
+ WantPatches : []clientgotesting.PatchActionImpl {{
388
+ ActionImpl : clientgotesting.ActionImpl {
389
+ Namespace : "ns" ,
390
+ },
391
+ Name : "name" ,
392
+ Patch : []byte (`{"metadata":{"finalizers":["ingresses.networking.internal.knative.dev"],"resourceVersion":""}}` ),
393
+ }},
394
+ WantEvents : []string {
395
+ ktesting .Eventf (corev1 .EventTypeNormal , "FinalizerUpdate" , `Updated "name" finalizers` ),
396
+ ktesting .Eventf (corev1 .EventTypeNormal , "Created" , "Created HTTPRoute \" foo.svc.cluster.local\" " ),
397
+ },
398
+ }, {
399
+ Name : "No TLS ingress with httpOption redirected" ,
400
+ Key : "ns/name" ,
401
+ Objects : append ([]runtime.Object {
402
+ ing (withBasicSpec , withGatewayAPIClass , withHTTPOptionRedirected ),
403
+ secret (secretName , nsName ),
404
+ gw (defaultListener ),
405
+ }, servicesAndEndpoints ... ),
406
+ WantCreates : []runtime.Object {
407
+ httpRoute (t , ing (withBasicSpec , withGatewayAPIClass , withHTTPOptionRedirected ), withSectionName ("kni-" )),
408
+ },
409
+ WantStatusUpdates : []clientgotesting.UpdateActionImpl {{
410
+ Object : ing (withBasicSpec , withGatewayAPIClass , withHTTPOptionRedirected , func (i * v1alpha1.Ingress ) {
411
+ // These are the things we expect to change in status.
412
+ i .Status .InitializeConditions ()
413
+ i .Status .MarkIngressNotReady ("ReconcileIngressFailed" , "Ingress reconciliation failed" )
414
+ }),
415
+ }},
416
+ WantPatches : []clientgotesting.PatchActionImpl {{
417
+ ActionImpl : clientgotesting.ActionImpl {
418
+ Namespace : "ns" ,
419
+ },
420
+ Name : "name" ,
421
+ Patch : []byte (`{"metadata":{"finalizers":["ingresses.networking.internal.knative.dev"],"resourceVersion":""}}` ),
422
+ }},
423
+ WantEvents : []string {
424
+ ktesting .Eventf (corev1 .EventTypeNormal , "FinalizerUpdate" , `Updated "name" finalizers` ),
425
+ ktesting .Eventf (corev1 .EventTypeNormal , "Created" , "Created HTTPRoute \" example.com\" " ),
426
+ ktesting .Eventf (corev1 .EventTypeWarning , "InternalError" , "no TLS configuration provided in `spec.tls`. Failed to create HTTPRoute for HTTPS redirection" ),
427
+ },
428
+ WantErr : true ,
368
429
}}
369
430
370
431
table .Test (t , GatewayFactory (func (ctx context.Context , listers * gwtesting.Listers , _ configmap.Watcher , tr * ktesting.TableRow ) controller.Reconciler {
0 commit comments