Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip vetted tests #1091

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tests/whitebox/_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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.
Expand Down
20 changes: 12 additions & 8 deletions tests/whitebox/integration/report/test_get_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
Expand Down
Loading