diff --git a/lib/charms/observability_libs/v1/cert_handler.py b/lib/charms/observability_libs/v1/cert_handler.py index bb892f9..78be36f 100644 --- a/lib/charms/observability_libs/v1/cert_handler.py +++ b/lib/charms/observability_libs/v1/cert_handler.py @@ -283,7 +283,7 @@ def __init__( peer_relation_name: str = "peers", cert_subject: Optional[str] = None, sans: Optional[List[str]] = None, - refresh_events: List[BoundEvent] = [], + refresh_events: Optional[List[BoundEvent]] = None, ): """CertHandler is used to wrap TLS Certificates management operations for charms. @@ -360,8 +360,9 @@ def __init__( self._on_upgrade_charm, ) - for ev in refresh_events: - self.framework.observe(ev, self._on_refresh_event) + if refresh_events: + for ev in refresh_events: + self.framework.observe(ev, self._on_refresh_event) def _on_refresh_event(self, _): """Replace the latest current CSR with a new one if there are any CSR changes. diff --git a/tox.ini b/tox.ini index e7f1122..060c63e 100644 --- a/tox.ini +++ b/tox.ini @@ -26,6 +26,11 @@ passenv = HTTP_PROXY HTTPS_PROXY NO_PROXY +allowlist_externals = charmcraft +commands = + # update all charm libs + charmcraft fetch-lib charms.tls_certificates_interface.v3.tls_certificates + charmcraft fetch-lib charms.tls_certificates_interface.v2.tls_certificates [testenv:fmt] description = Apply coding style standards to code @@ -96,10 +101,7 @@ commands = pytest -v --tb native --log-cli-level=INFO -s {posargs} {toxinidir}/tests/integration [testenv:scenario] -description = Scenario tests (CI satisfaction placeholder) - -[testenv:scenario-manual] -description = Scenario tests (manual only: GH runner does not like charmcraft fetch-lib) +description = Scenario tests deps = pytest ops-scenario @@ -110,6 +112,6 @@ allowlist_externals = charmcraft rm commands = - charmcraft fetch-lib charms.tls_certificates_interface.v2.tls_certificates + {[testenv]commands} pytest -v --tb native {[vars]tst_path}/scenario --log-cli-level=INFO -s {posargs} rm -rf ./lib/charms/tls_certificates_interface