From 49e95801e61ab2871b550741e81074fa703dba1d Mon Sep 17 00:00:00 2001 From: Robert Gildein Date: Mon, 10 Jun 2024 18:51:10 +0200 Subject: [PATCH] drop relation name constant, fix waiting for apps --- src/charm.py | 4 +--- tests/integration/test_charm.py | 9 ++++++++- tests/unit/test_charm.py | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/charm.py b/src/charm.py index d3f99089..d8028970 100755 --- a/src/charm.py +++ b/src/charm.py @@ -24,7 +24,6 @@ METRICS_PATH = "/metrics" METRICS_PORT = "5558" -LOGGING_RELATION_NAME = "logging" class Operator(CharmBase): @@ -55,9 +54,8 @@ def __init__(self, *args): } ], ) - self._logging = LogForwarder(charm=self, relation_name=LOGGING_RELATION_NAME) - self.dashboard_provider = GrafanaDashboardProvider(self) + self._logging = LogForwarder(charm=self) self._container_name = "dex" self._namespace = self.model.name diff --git a/tests/integration/test_charm.py b/tests/integration/test_charm.py index f212888b..46850e7d 100644 --- a/tests/integration/test_charm.py +++ b/tests/integration/test_charm.py @@ -76,7 +76,6 @@ async def test_build_and_deploy(ops_test): await ops_test.model.wait_for_idle( apps=[DEX_AUTH_APP_NAME], status="active", raise_on_blocked=True, timeout=600 ) - assert ops_test.model.applications[DEX_AUTH_APP_NAME].units[0].workload_status == "active" # Deploying grafana-agent-k8s and add all relations await deploy_and_assert_grafana_agent( @@ -169,6 +168,14 @@ async def test_relations(ops_test: OpsTest): await ops_test.model.applications[OIDC_GATEKEEPER].set_config({"public-url": public_url}) await ops_test.model.wait_for_idle( + apps=[ + DEX_AUTH_APP_NAME, + ISTIO_PILOT, + ISTIO_GATEWAY_APP_NAME, + OIDC_GATEKEEPER, + KUBEFLOW_PROFILES, + KUBEFLOW_DASHBOARD, + ], status="active", raise_on_blocked=False, raise_on_error=True, diff --git a/tests/unit/test_charm.py b/tests/unit/test_charm.py index 3a06aa01..624003b8 100644 --- a/tests/unit/test_charm.py +++ b/tests/unit/test_charm.py @@ -21,7 +21,7 @@ def harness(): def test_log_forwarding(harness): with patch("charm.LogForwarder") as mock_logging: harness.begin() - mock_logging.assert_called_once_with(charm=harness.charm, relation_name="logging") + mock_logging.assert_called_once_with(charm=harness.charm) @patch("charm.KubernetesServicePatch", lambda *_, **__: None)