This is an automated email from the ASF dual-hosted git repository. mck pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cassandra-dtest.git
The following commit(s) were added to refs/heads/master by this push: new 7da11dd Introduce --execute-upgrade-tests-only to only run upgrade tests 7da11dd is described below commit 7da11ddc2da9a5c4938044c21909ac4221580687 Author: Eduard Tudenhoefner <eduard.tudenhoef...@datastax.com> AuthorDate: Thu Jun 4 08:33:26 2020 +0200 Introduce --execute-upgrade-tests-only to only run upgrade tests --- conftest.py | 44 ++++++++++++++++++++++++-------------------- dtest_config.py | 2 ++ run_dtests.py | 3 ++- 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/conftest.py b/conftest.py index 2629689..1fa5e22 100644 --- a/conftest.py +++ b/conftest.py @@ -1,32 +1,28 @@ -import pytest +import copy +import inspect import logging import os +import platform +import re import shutil import time -import re -import platform -import copy -import inspect -import subprocess - -from dtest import running_in_docker, cleanup_docker_environment_before_test_execution - from datetime import datetime from distutils.version import LooseVersion -from netifaces import AF_INET -from psutil import virtual_memory +# Python 3 imports +from itertools import zip_longest -import netifaces as ni import ccmlib.repository +import netifaces as ni +import pytest from ccmlib.common import validate_install_dir, is_win, get_version_from_build +from netifaces import AF_INET +from psutil import virtual_memory +from dtest import running_in_docker, cleanup_docker_environment_before_test_execution from dtest_config import DTestConfig from dtest_setup import DTestSetup from dtest_setup_overrides import DTestSetupOverrides -# Python 3 imports -from itertools import zip_longest - logger = logging.getLogger(__name__) def check_required_loopback_interfaces_available(): @@ -76,6 +72,8 @@ def pytest_addoption(parser): help="Delete all generated logs created by a test after the completion of a test.") parser.addoption("--execute-upgrade-tests", action="store_true", default=False, help="Execute Cassandra Upgrade Tests (e.g. tests annotated with the upgrade_test mark)") + parser.addoption("--execute-upgrade-tests-only", action="store_true", default=False, + help="Execute Cassandra Upgrade Tests without running any other tests") parser.addoption("--disable-active-log-watching", action="store_true", default=False, help="Disable ccm active log watching, which will cause dtests to check for errors in the " "logs in a single operation instead of semi-realtime processing by consuming " @@ -477,6 +475,11 @@ def pytest_collection_modifyitems(items, config): for item in items: deselect_test = False + if config.getoption("--execute-upgrade-tests-only"): + deselect_test = not item.get_closest_marker("upgrade_test") + if deselect_test: + logger.info("SKIP: Deselecting non-upgrade test %s because of --execute-upgrade-tests-only" % item.name) + if item.get_closest_marker("resource_intensive") and not collect_only: force_resource_intensive = config.getoption("--force-resource-intensive-tests") skip_resource_intensive = config.getoption("--skip-resource-intensive-tests") @@ -495,7 +498,6 @@ def pytest_collection_modifyitems(items, config): deselect_test = True logger.info("SKIP: Deselecting non resource_intensive test %s as --only-resource-intensive-tests specified" % item.name) - if item.get_closest_marker("no_vnodes"): if config.getoption("--use-vnodes"): deselect_test = True @@ -514,12 +516,10 @@ def pytest_collection_modifyitems(items, config): for module_pytest_mark in test_item_class[1].pytestmark: if module_pytest_mark.name == "upgrade_test": - if not config.getoption("--execute-upgrade-tests"): - deselect_test = True + deselect_test = not _upgrade_testing_enabled(config) if item.get_closest_marker("upgrade_test"): - if not config.getoption("--execute-upgrade-tests"): - deselect_test = True + deselect_test = not _upgrade_testing_enabled(config) if item.get_closest_marker("no_offheap_memtables"): if config.getoption("use_off_heap_memtables"): @@ -536,3 +536,7 @@ def pytest_collection_modifyitems(items, config): config.hook.pytest_deselected(items=deselected_items) items[:] = selected_items + + +def _upgrade_testing_enabled(config): + return config.getoption("--execute-upgrade-tests") or config.getoption("--execute-upgrade-tests-only") diff --git a/dtest_config.py b/dtest_config.py index 358224e..25e9550 100644 --- a/dtest_config.py +++ b/dtest_config.py @@ -17,6 +17,7 @@ class DTestConfig: self.cassandra_version_from_build = None self.delete_logs = False self.execute_upgrade_tests = False + self.execute_upgrade_tests_only = False self.disable_active_log_watching = False self.keep_test_dir = False self.enable_jacoco_code_coverage = False @@ -38,6 +39,7 @@ class DTestConfig: self.delete_logs = request.config.getoption("--delete-logs") self.execute_upgrade_tests = request.config.getoption("--execute-upgrade-tests") + self.execute_upgrade_tests_only = request.config.getoption("--execute-upgrade-tests-only") self.disable_active_log_watching = request.config.getoption("--disable-active-log-watching") self.keep_test_dir = request.config.getoption("--keep-test-dir") self.enable_jacoco_code_coverage = request.config.getoption("--enable-jacoco-code-coverage") diff --git a/run_dtests.py b/run_dtests.py index c3939f1..e239359 100755 --- a/run_dtests.py +++ b/run_dtests.py @@ -1,7 +1,7 @@ #!/usr/bin/env python """ usage: run_dtests.py [-h] [--use-vnodes] [--use-off-heap-memtables] [--num-tokens NUM_TOKENS] [--data-dir-count-per-instance DATA_DIR_COUNT_PER_INSTANCE] [--force-resource-intensive-tests] - [--skip-resource-intensive-tests] [--cassandra-dir CASSANDRA_DIR] [--cassandra-version CASSANDRA_VERSION] [--delete-logs] [--execute-upgrade-tests] [--disable-active-log-watching] + [--skip-resource-intensive-tests] [--cassandra-dir CASSANDRA_DIR] [--cassandra-version CASSANDRA_VERSION] [--delete-logs] [--execute-upgrade-tests] [--execute-upgrade-tests-only] [--disable-active-log-watching] [--keep-test-dir] [--enable-jacoco-code-coverage] [--dtest-enable-debug-logging] [--dtest-print-tests-only] [--dtest-print-tests-output DTEST_PRINT_TESTS_OUTPUT] [--pytest-options PYTEST_OPTIONS] [--dtest-tests DTEST_TESTS] @@ -17,6 +17,7 @@ optional arguments: --cassandra-version CASSANDRA_VERSION --delete-logs --execute-upgrade-tests Execute Cassandra Upgrade Tests (e.g. tests annotated with the upgrade_test mark) (default: False) + --execute-upgrade-tests-only Execute Cassandra Upgrade Tests without running any other tests (e.g. tests annotated with the upgrade_test mark) (default: False) --disable-active-log-watching Disable ccm active log watching, which will cause dtests to check for errors in the logs in a single operation instead of semi-realtime processing by consuming ccm _log_error_handler callbacks (default: False) --keep-test-dir Do not remove/cleanup the test ccm cluster directory and it's artifacts after the test completes (default: False) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org