From d4fcdd69952dde72f955f53390ebf8d8c53892d8 Mon Sep 17 00:00:00 2001 From: Mick Semb Wever Date: Sun, 16 Jul 2023 13:15:43 +0200 Subject: [PATCH] Run generated upgrade_through_versions_test on pytest >7.2.0 pytest-7.2.0 changed how markers were inherited, https://github.com/pytest-dev/pytest/issues/7792 patch by Mick Semb Wever; reviewed by XXX for CASSANDRA-18499 --- conftest.py | 4 ++-- upgrade_tests/upgrade_through_versions_test.py | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/conftest.py b/conftest.py index 3eb8a10948..ef3a9d4701 100644 --- a/conftest.py +++ b/conftest.py @@ -113,8 +113,8 @@ def pytest_configure(config): def sufficient_system_resources_for_resource_intensive_tests(): mem = virtual_memory() total_mem_gb = mem.total / 1024 / 1024 / 1024 - logger.info("total available system memory is %dGB" % total_mem_gb) - # todo kjkj: do not hard code our bound.. for now just do 9 instances at 3gb a piece + logger.info("total available system memory is %dGB, require 27GB for resource intensive tests" % total_mem_gb) + # do not hard code our bound.. for now just do 9 instances at 3gb a piece return total_mem_gb >= 9 * 3 diff --git a/upgrade_tests/upgrade_through_versions_test.py b/upgrade_tests/upgrade_through_versions_test.py index 1fc39d7c7a..c08b3383fd 100644 --- a/upgrade_tests/upgrade_through_versions_test.py +++ b/upgrade_tests/upgrade_through_versions_test.py @@ -22,8 +22,8 @@ from tools.misc import generate_ssl_stores, new_node from .upgrade_manifest import (build_upgrade_pairs, current_2_2_x, - current_3_0_x, indev_3_11_x, current_3_11_x, - current_4_0_x, indev_4_1_x, current_4_1_x, + current_3_0_x, current_3_11_x, + current_4_0_x, current_4_1_x, indev_trunk, CASSANDRA_4_0, CASSANDRA_5_0, RUN_STATIC_UPGRADE_MATRIX) @@ -297,7 +297,7 @@ def shutdown_gently(): @pytest.mark.upgrade_test @pytest.mark.resource_intensive -@pytest.mark.skip("Fake skip so that this isn't run outside of a generated class that removes this annotation") +@pytest.mark.skip(reason="Skip base class, only generated classes run the tests") class TestUpgrade(Tester): """ Upgrades a 3-node Murmur3Partitioner cluster through versions specified in test_version_metas. @@ -886,9 +886,11 @@ def create_upgrade_class(clsname, version_metas, protocol_version, # Remove the skip annotation in the superclass we just derived from, we will add it back if we actually intend # to skip with a better message newcls.pytestmark = [mark for mark in newcls.pytestmark if not mark.name == "skip"] - #if not upgrade_applies_to_env: - #print("boo") - #newcls.pytestmark.append(pytest.mark.skip("test not applicable to env")) + # Remove the skip annotation from the parent_class too, it has already effectively been skipped + TestUpgrade.pytestmark = [mark for mark in TestUpgrade.pytestmark if not mark.name == "skip"] + if not upgrade_applies_to_env: + print("re-adding skip annotation to {} ".format(clsname)) + newcls.pytestmark.append(pytest.mark.skip("test not applicable to env")) print(newcls.pytestmark) if clsname in globals():