@@ -246,6 +246,7 @@ func TestBuildGateway(t *testing.T) {
246246	foo443TLSListener  :=  createTLSListener ("foo-443-tls" , "foo.example.com" , 443 )
247247
248248	// invalid listeners 
249+ 	// TCP listener with hostname is invalid because TCP doesn't support hostname 
249250	invalidProtocolListener  :=  createTCPListener ("invalid-protocol" , "bar.example.com" , 80 )
250251	invalidPortListener  :=  createHTTPListener ("invalid-port" , "invalid-port" , 0 )
251252	invalidProtectedPortListener  :=  createHTTPListener ("invalid-protected-port" , "invalid-protected-port" , 9113 )
@@ -760,10 +761,13 @@ func TestBuildGateway(t *testing.T) {
760761							GatewayName : client .ObjectKeyFromObject (getLastCreatedGateway ()),
761762							Source :      invalidProtocolListener ,
762763							Valid :       false ,
763- 							Attachable :  false ,
764- 							Conditions : conditions .NewListenerUnsupportedProtocol (
765- 								`protocol: Unsupported value: "TCP": supported values: "HTTP", "HTTPS", "TLS" ` ,
764+ 							Attachable :  true ,
765+ 							Conditions : conditions .NewListenerUnsupportedValue (
766+ 								`hostname: Forbidden: hostname is not supported for TCP listener ` ,
766767							),
768+ 							SupportedKinds : []v1.RouteGroupKind {
769+ 								{Kind : kinds .TCPRoute , Group : helpers.GetPointer [v1.Group ](v1 .GroupName )},
770+ 							},
767771							Routes :   map [RouteKey ]* L7Route {},
768772							L4Routes : map [L4RouteKey ]* L4Route {},
769773						},
@@ -775,7 +779,7 @@ func TestBuildGateway(t *testing.T) {
775779					Valid : true ,
776780				},
777781			},
778- 			name : "invalid listener protocol" ,
782+ 			name : "invalid listener protocol" ,  // Actually tests TCP listener with invalid hostname 
779783		},
780784		{
781785			gateway : createGateway (
0 commit comments