From cee3497c90102a553984d91ea10688817247fc84 Mon Sep 17 00:00:00 2001 From: Archana Pandey Date: Thu, 5 Dec 2024 13:05:49 +0530 Subject: [PATCH] feat(test): Adding custom markers to tests for gating tests --- integration-tests/pytest.ini | 6 ++++++ integration-tests/test_connect.py | 1 + integration-tests/test_disconnect.py | 1 + integration-tests/test_status.py | 4 +++- integration-tests/test_version.py | 4 ++++ 5 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 integration-tests/pytest.ini diff --git a/integration-tests/pytest.ini b/integration-tests/pytest.ini new file mode 100644 index 0000000..26e6306 --- /dev/null +++ b/integration-tests/pytest.ini @@ -0,0 +1,6 @@ +[pytest] +markers = + gating : mark a test that should run for gating jobs + tier1 : mark a test to run as tier1 priority + tier2 : mark a test to run as tier2 priority + diff --git a/integration-tests/test_connect.py b/integration-tests/test_connect.py index 62bc44d..58df10d 100644 --- a/integration-tests/test_connect.py +++ b/integration-tests/test_connect.py @@ -20,6 +20,7 @@ logger = logging.getLogger(__name__) +@pytest.mark.gating @pytest.mark.parametrize("auth", ["basic", "activation-key"]) def test_connect(external_candlepin, rhc, test_config, auth): """Test if RHC can connect to CRC using basic auth and activation key, diff --git a/integration-tests/test_disconnect.py b/integration-tests/test_disconnect.py index b6b9e27..767a6be 100644 --- a/integration-tests/test_disconnect.py +++ b/integration-tests/test_disconnect.py @@ -9,6 +9,7 @@ from utils import yggdrasil_service_is_active +@pytest.mark.gating def test_rhc_disconnect(external_candlepin, rhc, test_config): """Verify that RHC disconnect command disconnects host from server and deactivates yggdrasil service. diff --git a/integration-tests/test_status.py b/integration-tests/test_status.py index 8ad6148..23001f9 100644 --- a/integration-tests/test_status.py +++ b/integration-tests/test_status.py @@ -9,6 +9,7 @@ from utils import yggdrasil_service_is_active +@pytest.mark.gating def test_status_connected(external_candlepin, rhc, test_config): """Test RHC Status command when the host is connected. test_steps: @@ -47,7 +48,7 @@ def test_status_connected_format_json(external_candlepin, rhc, test_config): """ rhc.connect( username=test_config.get("candlepin.username"), - password=test_config.get("candlepin.password") + password=test_config.get("candlepin.password"), ) status_result = rhc.run("status", "--format", "json", check=False) assert status_result.returncode == 0 @@ -61,6 +62,7 @@ def test_status_connected_format_json(external_candlepin, rhc, test_config): assert type(status_json["yggdrasil_running"]) == bool +@pytest.mark.gating def test_status_disconnected(rhc): """Test RHC Status command when the host is disconnected. Ref: https://issues.redhat.com/browse/CCT-525 diff --git a/integration-tests/test_version.py b/integration-tests/test_version.py index a66c729..16c9f96 100644 --- a/integration-tests/test_version.py +++ b/integration-tests/test_version.py @@ -1,3 +1,7 @@ +import pytest + + +@pytest.mark.gating def test_version(rhc): proc = rhc.run("--version") assert "rhc version " in proc.stdout