From 1b462d46200c0d4f91eb3cd55489d58458411309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Rebollo=20P=C3=A9rez?= Date: Mon, 20 Feb 2023 18:11:33 +0000 Subject: [PATCH] fix(#3969): renamed parameter and minnor fixes --- deps/wazuh_testing/wazuh_testing/tools/utils.py | 9 +++------ tests/integration/conftest.py | 10 ++++------ .../test_gcloud/test_functionality/test_rules.py | 9 ++++----- tests/performance/test_api/conftest.py | 2 +- tests/performance/test_cluster/conftest.py | 2 +- .../test_cluster/test_cluster_logs/conftest.py | 2 +- 6 files changed, 14 insertions(+), 20 deletions(-) diff --git a/deps/wazuh_testing/wazuh_testing/tools/utils.py b/deps/wazuh_testing/wazuh_testing/tools/utils.py index e5f22d73ee..346bfddb87 100644 --- a/deps/wazuh_testing/wazuh_testing/tools/utils.py +++ b/deps/wazuh_testing/wazuh_testing/tools/utils.py @@ -131,12 +131,9 @@ def get_random_string(string_length, digits=True): def get_version(): - try: - f = open('../../version.json') - data = json.load(f) - version = data['version'] - except Exception: - version = 'N/A' + f = open('../../version.json') + data = json.load(f) + version = data['version'] return version diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index c74442ea2d..0454b5fe7f 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -58,9 +58,7 @@ def get_report_files(): def pytest_collection_modifyitems(session, config, items): selected_tests = [] deselected_tests = [] - print(session) - print(config) - if not global_parameters.allow_platform_deselected_tests: + if not global_parameters.avoid_platform_based_deselection: for item in items: supported_platforms = PLATFORMS.intersection(mark.name for mark in item.iter_markers()) plat = sys.platform @@ -314,7 +312,7 @@ def pytest_addoption(parser): ) parser.addoption( - "--allow-platform-deselected-tests", + "--avoid-platform-based-deselection", action="store_true", default=False, help="Avoid tests deselection based on current environment" @@ -389,7 +387,7 @@ def pytest_configure(config): global_parameters.wpk_package_path = global_parameters.wpk_package_path # Set collect test mode - global_parameters.allow_platform_deselected_tests = config.getoption("--allow-platform-deselected-tests") + global_parameters.avoid_platform_based_deselection = config.getoption("--avoid_platform_based_deselection") @@ -1263,4 +1261,4 @@ def pytest_deselected(items): reporter = config.pluginmanager.getplugin("terminalreporter") reporter.ensure_newline() for item in items: - reporter.line(f"deselected: {item.nodeid}", yellow=True, bold=True) \ No newline at end of file + reporter.line(f"deselected: {item.nodeid}", yellow=True, bold=True) diff --git a/tests/integration/test_gcloud/test_functionality/test_rules.py b/tests/integration/test_gcloud/test_functionality/test_rules.py index 8abe88c06e..b4333e6e93 100644 --- a/tests/integration/test_gcloud/test_functionality/test_rules.py +++ b/tests/integration/test_gcloud/test_functionality/test_rules.py @@ -92,11 +92,10 @@ # Preparing - -@pytest.fixture(scope='module', params=configurations) -def get_configuration(request): - """Get configurations from the module.""" - return request.param +@pytest.fixture(scope='module', autouse=True) +def truncate_logs(): + """Truncate the 'ossec.log' file.""" + truncate_file(LOG_FILE_PATH) # fixtures diff --git a/tests/performance/test_api/conftest.py b/tests/performance/test_api/conftest.py index 44b58bc006..f745964c04 100755 --- a/tests/performance/test_api/conftest.py +++ b/tests/performance/test_api/conftest.py @@ -174,4 +174,4 @@ def pytest_collection_modifyitems(session, config, items): # Add each test_case metadata as user_properties for its item for item in items: if hasattr(item, 'callspec') and 'test_case' in item.callspec.params: - item.user_properties.extend([(key, value) for key, value in item.callspec.params['test_case'].items()]) \ No newline at end of file + item.user_properties.extend([(key, value) for key, value in item.callspec.params['test_case'].items()]) diff --git a/tests/performance/test_cluster/conftest.py b/tests/performance/test_cluster/conftest.py index 8847f1cad8..b550384c87 100644 --- a/tests/performance/test_cluster/conftest.py +++ b/tests/performance/test_cluster/conftest.py @@ -11,7 +11,7 @@ def pytest_addoption(parser): # Get command line options parser.addoption( - "--performance-artifacts_path", + "--artifacts_path", action="store", type=str, help="Path where information of all cluster nodes can be found (logs, stats CSVs, etc)." diff --git a/tests/reliability/test_cluster/test_cluster_logs/conftest.py b/tests/reliability/test_cluster/test_cluster_logs/conftest.py index 3b56d9f860..faab49f847 100644 --- a/tests/reliability/test_cluster/test_cluster_logs/conftest.py +++ b/tests/reliability/test_cluster/test_cluster_logs/conftest.py @@ -11,7 +11,7 @@ def pytest_addoption(parser): # Get command line options parser.addoption( - "--reliability-artifacts-path", + "--artifacts_path", action="store", type=str, help="Path where information of all cluster nodes can be found (logs, stats CSVs, etc)."