diff --git a/src/charm.py b/src/charm.py index ef3441c78..9c6fb032b 100755 --- a/src/charm.py +++ b/src/charm.py @@ -379,13 +379,13 @@ def _alerting_config(self) -> str: to send notifications to. """ alerting_config = "" - alertmanagers = self.alertmanager_consumer.get_cluster_info() + alertmanagers = self.alertmanager_consumer.get_cluster_info_with_scheme() if not alertmanagers: logger.debug("No alertmanagers available") return alerting_config - return ",".join([f"http://{am}" for am in alertmanagers]) + return ",".join(alertmanagers) def _running_config(self) -> Dict[str, Any]: """Get the on-disk Loki config.""" diff --git a/tests/unit/test_charm.py b/tests/unit/test_charm.py index 99dcd61be..4c1f84d98 100644 --- a/tests/unit/test_charm.py +++ b/tests/unit/test_charm.py @@ -127,14 +127,14 @@ def setUp(self, *_): def test__alerting_config(self): self.harness.charm.alertmanager_consumer = Mock() - self.harness.charm.alertmanager_consumer.get_cluster_info.return_value = [ - "10.1.2.52", - "10.1.3.52", + self.harness.charm.alertmanager_consumer.get_cluster_info_with_scheme.return_value = [ + "http://10.1.2.52", + "http://10.1.3.52", ] expected_value = "http://10.1.2.52,http://10.1.3.52" self.assertEqual(self.harness.charm._alerting_config(), expected_value) - self.harness.charm.alertmanager_consumer.get_cluster_info.return_value = [] + self.harness.charm.alertmanager_consumer.get_cluster_info_with_scheme.return_value = [] expected_value = "" self.assertEqual(self.harness.charm._alerting_config(), expected_value)