diff --git a/tests/whitebox/_misc.py b/tests/whitebox/_misc.py index d15c42bc0..3634ed3bc 100644 --- a/tests/whitebox/_misc.py +++ b/tests/whitebox/_misc.py @@ -39,6 +39,11 @@ _OK = StratisCliErrorCodes.OK +_STRATIS_SKIP_TESTS_VALUE = os.getenv("STRATIS_SKIP_TESTS") +_STRATIS_SKIP_TESTS = ( + [] if _STRATIS_SKIP_TESTS_VALUE is None else _STRATIS_SKIP_TESTS_VALUE.split(";") +) + def device_name_list(min_devices=0, max_devices=10, unique=False): """ @@ -336,6 +341,14 @@ def test_runner(command_line, stdin=None): TEST_RUNNER = test_runner +def skip_if_requested(test_id): + """ + Return true if the test id is included in the environment variable + STRATIS_SKIP_TESTS. + """ + return any(x.endswith(test_id) for x in _STRATIS_SKIP_TESTS) + + def get_pool(proxy, pool_name): """ Get pool information given a pool name. diff --git a/tests/whitebox/integration/report/test_get_report.py b/tests/whitebox/integration/report/test_get_report.py index 5412540d4..06a8758a6 100644 --- a/tests/whitebox/integration/report/test_get_report.py +++ b/tests/whitebox/integration/report/test_get_report.py @@ -16,14 +16,13 @@ """ # isort: STDLIB -import os import unittest # isort: LOCAL from stratis_cli import StratisCliErrorCodes from stratis_cli._stratisd_constants import ReportKey -from .._misc import TEST_RUNNER, SimTestCase +from .._misc import TEST_RUNNER, SimTestCase, skip_if_requested _ERROR = StratisCliErrorCodes.ERROR @@ -35,30 +34,35 @@ class ReportTestCase(SimTestCase): _MENU = ["--propagate", "report"] - @unittest.skipIf( - os.getenv("STRATIS_SKIP_UNSTABLE_TEST") is not None, - "This test relies on the Report interface's GetReport method which " - "does not guarantee the stability, between minor versions of stratisd, " - "of the report key arguments that it supports.", - ) + @unittest.skipIf(skip_if_requested("ReportTestCase.test_report"), "skip requested") def test_report(self): """ Test getting stopped pool report. """ TEST_RUNNER(self._MENU + [ReportKey.STOPPED_POOLS.value]) + @unittest.skipIf( + skip_if_requested("ReportTestCase.test_report_no_name"), "skip requested" + ) def test_report_no_name(self): """ Test getting engine state report when no name specified. """ TEST_RUNNER(self._MENU) + @unittest.skipIf( + skip_if_requested("ReportTestCase.test_engine_state_report"), "skip requested" + ) def test_engine_state_report(self): """ Test getting engine state report. """ TEST_RUNNER(self._MENU + [ReportKey.ENGINE_STATE.value]) + @unittest.skipIf( + skip_if_requested("ReportTestCase.test_managed_objects_report"), + "skip requested", + ) def test_managed_objects_report(self): """ Test getting managed_objects report.