From 6e515e46e8d65036801ff7b2ca63fa38eaca6809 Mon Sep 17 00:00:00 2001 From: Ashley James Date: Fri, 1 Dec 2023 19:46:03 +0530 Subject: [PATCH 1/3] Fix alert rules for failed collector. --- tests/unit/test_alert_rules/test_general.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/unit/test_alert_rules/test_general.yaml b/tests/unit/test_alert_rules/test_general.yaml index 6c0cb053..fe74bd19 100644 --- a/tests/unit/test_alert_rules/test_general.yaml +++ b/tests/unit/test_alert_rules/test_general.yaml @@ -6,9 +6,9 @@ evaluation_interval: 1m tests: - interval: 1m input_series: - - series: ipmidcmicollector_collector_failed{instance="ubuntu-99", collector="IPMIDCMICollector"} + - series: ipmidcmi_collector_failed{instance="ubuntu-99", collector="ipmidcmi"} values: '1x15' - - series: ipmiselcollector_collector_failed{instance="ubuntu-99", collector="IPMISELCollector"} + - series: ipmisel_collector_failed{instance="ubuntu-99", collector="ipmisel"} values: '1x15' alert_rule_test: @@ -18,18 +18,18 @@ tests: - exp_labels: severity: error instance: ubuntu-99 - collector: IPMIDCMICollector + collector: ipmidcmi exp_annotations: summary: Collector failed. (instance ubuntu-99) description: | A collector failed to fetch the metrics. Please reach out to hardware-observer maintainers. - LABELS = map[__name__:ipmidcmicollector_collector_failed collector:IPMIDCMICollector instance:ubuntu-99] + LABELS = map[__name__:ipmidcmi_collector_failed collector:ipmidcmi instance:ubuntu-99] - exp_labels: severity: error instance: ubuntu-99 - collector: IPMISELCollector + collector: ipmisel exp_annotations: summary: Collector failed. (instance ubuntu-99) description: | A collector failed to fetch the metrics. Please reach out to hardware-observer maintainers. - LABELS = map[__name__:ipmiselcollector_collector_failed collector:IPMISELCollector instance:ubuntu-99] + LABELS = map[__name__:ipmisel_collector_failed collector:ipmisel instance:ubuntu-99] From 36be58604e5dc5e6b5736a94e4595df6eccb84b1 Mon Sep 17 00:00:00 2001 From: Ashley James Date: Mon, 4 Dec 2023 11:52:25 +0530 Subject: [PATCH 2/3] Set asyncio mark in test module. func tests for juju 2.9/focal were failing. This was because the asyncio marker was not added to the tests. This change adds the markers automatically to all the tests by setting `pytestmark`. --- tests/functional/test_charm.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/functional/test_charm.py b/tests/functional/test_charm.py index fc7cfb02..c3fd52dd 100644 --- a/tests/functional/test_charm.py +++ b/tests/functional/test_charm.py @@ -14,6 +14,7 @@ from pytest_operator.plugin import OpsTest logger = logging.getLogger(__name__) +pytestmark = pytest.mark.asyncio(scope="module") METADATA = yaml.safe_load(Path("./metadata.yaml").read_text()) APP_NAME = METADATA["name"] From e88cdf0fde24c9cfb7e0ea5c339a9b5316749479 Mon Sep 17 00:00:00 2001 From: Ashley James Date: Tue, 5 Dec 2023 12:45:12 +0530 Subject: [PATCH 3/3] Revert 36be586 --- tests/functional/test_charm.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/functional/test_charm.py b/tests/functional/test_charm.py index c3fd52dd..fc7cfb02 100644 --- a/tests/functional/test_charm.py +++ b/tests/functional/test_charm.py @@ -14,7 +14,6 @@ from pytest_operator.plugin import OpsTest logger = logging.getLogger(__name__) -pytestmark = pytest.mark.asyncio(scope="module") METADATA = yaml.safe_load(Path("./metadata.yaml").read_text()) APP_NAME = METADATA["name"]