Skip to content

Commit

Permalink
Fix tls secret deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
averevki committed Oct 18, 2023
1 parent d97df08 commit db0f5c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions testsuite/openshift/objects/gateway_api/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ def get_tls_cert(self) -> Certificate:
)
return tls_cert

def delete_tls_secret(self):
"""Deletes secret with TLS certificate used by the gateway"""
tls_cert_secret_name = self.model.spec.listeners[0].tls.certificateRefs[0].name
self.openshift.get_secret(tls_cert_secret_name).delete(ignore_not_found=True)

def get_spoke_gateway(self, spokes: dict[str, OpenShiftClient]) -> "MGCGateway":
"""
Returns spoke gateway on an arbitrary, and sometimes, random spoke cluster.
Expand Down
1 change: 1 addition & 0 deletions testsuite/tests/mgc/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def upstream_gateway(request, openshift, blame, hostname, module_label):
placement="http-gateway",
labels={"app": module_label},
)
request.addfinalizer(upstream_gateway.delete_tls_secret)
request.addfinalizer(upstream_gateway.delete)
upstream_gateway.commit()
# we cannot wait here because of referencing not yet existent tls secret which would be provided later by tlspolicy
Expand Down

0 comments on commit db0f5c1

Please sign in to comment.