@@ -16,6 +16,7 @@ import (
1616 clientgoscheme "k8s.io/client-go/kubernetes/scheme"
1717 testclient "sigs.k8s.io/controller-runtime/pkg/client/fake"
1818 gwv1 "sigs.k8s.io/gateway-api/apis/v1"
19+ gwv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
1920)
2021
2122func Test_LatticeServiceModelBuild (t * testing.T ) {
@@ -403,6 +404,31 @@ func Test_LatticeServiceModelBuild(t *testing.T) {
403404 ServiceNetworkNames : []string {vpcLatticeGateway .Name , "gateway2" },
404405 },
405406 },
407+ {
408+ name : "TLSRoute without hostname should fail" ,
409+ wantIsDeleted : false ,
410+ wantErrIsNil : false ,
411+ gwClass : vpcLatticeGatewayClass ,
412+ gws : []gwv1.Gateway {
413+ vpcLatticeGateway ,
414+ },
415+ route : core .NewTLSRoute (gwv1alpha2.TLSRoute {
416+ ObjectMeta : metav1.ObjectMeta {
417+ Name : "service1" ,
418+ Namespace : "default" ,
419+ },
420+ Spec : gwv1alpha2.TLSRouteSpec {
421+ CommonRouteSpec : gwv1.CommonRouteSpec {
422+ ParentRefs : []gwv1.ParentReference {
423+ {
424+ Name : gwv1 .ObjectName (vpcLatticeGateway .Name ),
425+ Namespace : namespacePtr (vpcLatticeGateway .Namespace ),
426+ },
427+ },
428+ },
429+ },
430+ }),
431+ },
406432 {
407433 name : "Multiple service networks with one different controller" ,
408434 wantIsDeleted : false ,
@@ -463,6 +489,7 @@ func Test_LatticeServiceModelBuild(t *testing.T) {
463489 k8sSchema := runtime .NewScheme ()
464490 clientgoscheme .AddToScheme (k8sSchema )
465491 gwv1 .Install (k8sSchema )
492+ gwv1alpha2 .Install (k8sSchema )
466493 k8sClient := testclient .NewClientBuilder ().WithScheme (k8sSchema ).Build ()
467494
468495 assert .NoError (t , k8sClient .Create (ctx , tt .gwClass .DeepCopy ()))
0 commit comments