@@ -2101,20 +2101,17 @@ func TestBuildCertificateStatuses(t *testing.T) {
21012101 },
21022102 }
21032103
2104- makeSharedTLSSecret := func (hasTLSData bool ) * corev1.Secret {
2105- s := & corev1.Secret {
2106- ObjectMeta : metav1.ObjectMeta {
2107- Namespace : downstreamNamespaceName ,
2108- Name : "wildcard-tls" ,
2104+ gatewayWithCustomHostname := & gatewayv1.Gateway {
2105+ ObjectMeta : metav1.ObjectMeta {Name : "my-proxy" , Namespace : "test-ns" },
2106+ Spec : gatewayv1.GatewaySpec {
2107+ Listeners : []gatewayv1.Listener {
2108+ {
2109+ Name : "https-hostname-0" ,
2110+ Protocol : gatewayv1 .HTTPSProtocolType ,
2111+ Hostname : ptr .To (gatewayv1 .Hostname ("custom.otherdomain.com" )),
2112+ },
21092113 },
2110- }
2111- if hasTLSData {
2112- s .Data = map [string ][]byte {
2113- "tls.crt" : []byte ("cert-data" ),
2114- "tls.key" : []byte ("key-data" ),
2115- }
2116- }
2117- return s
2114+ },
21182115 }
21192116
21202117 tests := []struct {
@@ -2171,41 +2168,20 @@ func TestBuildCertificateStatuses(t *testing.T) {
21712168 wantStatus : metav1 .ConditionFalse ,
21722169 },
21732170 {
2174- name : "shared TLS secret found and valid returns CertificateIssued " ,
2171+ name : "shared TLS marks certificate ready immediately " ,
21752172 config : & sharedTLSConfig ,
21762173 gateway : gatewayWithWildcardHostname ,
21772174 downstreamCluster : true ,
2178- downstreamObjects : []client.Object {makeSharedTLSSecret ( true ) },
2175+ downstreamObjects : []client.Object {},
21792176 wantLen : 1 ,
21802177 wantReason : networkingv1alpha .CertificateReadyReasonCertificateIssued ,
21812178 wantStatus : metav1 .ConditionTrue ,
2182- wantMessage : "Shared wildcard TLS certificate is ready" ,
2183- },
2184- {
2185- name : "shared TLS secret not found returns Pending" ,
2186- config : & sharedTLSConfig ,
2187- gateway : gatewayWithWildcardHostname ,
2188- downstreamCluster : true ,
2189- downstreamObjects : []client.Object {},
2190- wantLen : 1 ,
2191- wantReason : networkingv1alpha .CertificateReadyReasonPending ,
2192- wantStatus : metav1 .ConditionFalse ,
2193- wantMessage : "Shared TLS secret not found in downstream cluster" ,
2194- },
2195- {
2196- name : "shared TLS secret missing tls data returns Pending" ,
2197- config : & sharedTLSConfig ,
2198- gateway : gatewayWithWildcardHostname ,
2199- downstreamCluster : true ,
2200- downstreamObjects : []client.Object {makeSharedTLSSecret (false )},
2201- wantLen : 1 ,
2202- wantReason : networkingv1alpha .CertificateReadyReasonPending ,
2203- wantStatus : metav1 .ConditionFalse ,
2204- wantMessage : "Shared TLS secret is missing tls.crt or tls.key data" ,
2179+ wantMessage : "Using shared wildcard TLS certificate" ,
22052180 },
22062181 {
22072182 name : "custom hostname still checks certificate even with shared TLS enabled" ,
22082183 config : & sharedTLSConfig ,
2184+ gateway : gatewayWithCustomHostname ,
22092185 downstreamCluster : true ,
22102186 downstreamObjects : []client.Object {},
22112187 wantLen : 1 ,
0 commit comments