@@ -280,6 +280,7 @@ func TestEnsureDownstreamGatewayWildcardCert(t *testing.T) {
280280 existingUpstreamObjects []client.Object
281281 existingDownstreamObjects []client.Object
282282 assert func (t * testing.T , upstreamGateway , downstreamGateway * gatewayv1.Gateway )
283+ assertDownstream func (t * testing.T , downstreamClient client.Client , downstreamGateway * gatewayv1.Gateway )
283284 }{
284285 {
285286 name : "default https listener uses shared TLS secret" ,
@@ -378,6 +379,19 @@ func TestEnsureDownstreamGatewayWildcardCert(t *testing.T) {
378379 "cert-manager annotation should not be set; Certificates are created directly" ,
379380 )
380381 },
382+ assertDownstream : func (t * testing.T , downstreamClient client.Client , downstreamGateway * gatewayv1.Gateway ) {
383+ var cert cmv1.Certificate
384+ certKey := client.ObjectKey {
385+ Namespace : downstreamGateway .Namespace ,
386+ Name : listenerCertificateName ("test-gw" , "https-hostname-0" ),
387+ }
388+ if assert .NoError (t , downstreamClient .Get (context .Background (), certKey , & cert ), "Certificate should exist" ) {
389+ assert .True (t ,
390+ metav1 .IsControlledBy (& cert , downstreamGateway ),
391+ "Certificate should have downstream Gateway as controller owner so the solver controller can find it" ,
392+ )
393+ }
394+ },
381395 },
382396 {
383397 name : "subdomain of target domain uses shared wildcard cert" ,
@@ -548,6 +562,10 @@ func TestEnsureDownstreamGatewayWildcardCert(t *testing.T) {
548562 assert .NoError (t , fakeUpstreamClient .Get (ctx , client .ObjectKeyFromObject (tt .upstreamGateway ), updatedUpstreamGateway ))
549563 tt .assert (t , updatedUpstreamGateway , downstreamGateway )
550564 }
565+
566+ if tt .assertDownstream != nil {
567+ tt .assertDownstream (t , fakeDownstreamClient , downstreamGateway )
568+ }
551569 })
552570 }
553571}
0 commit comments