|
| 1 | +import pytest |
| 2 | + |
| 3 | +from tests.observability.constants import KUBEVIRT_VMI_NUMBER_OF_OUTDATED |
| 4 | +from tests.observability.utils import validate_metrics_value, wait_for_greater_than_zero_metric_value |
| 5 | +from tests.upgrade_params import IUO_UPGRADE_TEST_DEPENDENCY_NODE_ID |
| 6 | +from utilities.constants import DEPENDENCY_SCOPE_SESSION |
| 7 | + |
| 8 | + |
| 9 | +@pytest.mark.upgrade |
| 10 | +class TestUpgradeObservability: |
| 11 | + TEST_METRIC_KUBEVIRT_VMI_NUMBER_OF_OUTDATED_BEFORE_UPGRADE = ( |
| 12 | + "test_metric_kubevirt_vmi_number_of_outdated_before_upgrade" |
| 13 | + ) |
| 14 | + """Pre-upgrade tests""" |
| 15 | + |
| 16 | + @pytest.mark.order(before=IUO_UPGRADE_TEST_DEPENDENCY_NODE_ID) |
| 17 | + @pytest.mark.dependency(name=TEST_METRIC_KUBEVIRT_VMI_NUMBER_OF_OUTDATED_BEFORE_UPGRADE) |
| 18 | + @pytest.mark.polarion("CNV-11749") |
| 19 | + def test_metric_kubevirt_vmi_number_of_outdated_before_upgrade(self, prometheus, vm_with_node_selector_for_upgrade): |
| 20 | + validate_metrics_value( |
| 21 | + prometheus=prometheus, |
| 22 | + metric_name=KUBEVIRT_VMI_NUMBER_OF_OUTDATED, |
| 23 | + expected_value="0", |
| 24 | + ) |
| 25 | + |
| 26 | + """Post-upgrade tests""" |
| 27 | + |
| 28 | + @pytest.mark.polarion("CNV-11758") |
| 29 | + @pytest.mark.order(after=IUO_UPGRADE_TEST_DEPENDENCY_NODE_ID) |
| 30 | + @pytest.mark.dependency( |
| 31 | + depends=[IUO_UPGRADE_TEST_DEPENDENCY_NODE_ID, TEST_METRIC_KUBEVIRT_VMI_NUMBER_OF_OUTDATED_BEFORE_UPGRADE], |
| 32 | + scope=DEPENDENCY_SCOPE_SESSION, |
| 33 | + ) |
| 34 | + def test_metric_kubevirt_vmi_number_of_outdated_after_upgrade(self, prometheus): |
| 35 | + wait_for_greater_than_zero_metric_value( |
| 36 | + prometheus=prometheus, |
| 37 | + metric_name=KUBEVIRT_VMI_NUMBER_OF_OUTDATED, |
| 38 | + ) |
0 commit comments