diff --git a/deps/wazuh_testing/wazuh_testing/tools/__init__.py b/deps/wazuh_testing/wazuh_testing/tools/__init__.py index 51db9cfd8c..248413c943 100644 --- a/deps/wazuh_testing/wazuh_testing/tools/__init__.py +++ b/deps/wazuh_testing/wazuh_testing/tools/__init__.py @@ -97,9 +97,8 @@ def get_version(): return version[:version.rfind('\n')] else: # Linux, sunos5, darwin, aix... - return subprocess.check_output([ - f"{WAZUH_PATH}/bin/wazuh-control", "info", "-v" - ], stderr=subprocess.PIPE).decode('utf-8').rstrip() + return subprocess.check_output([f"{WAZUH_PATH}/bin/wazuh-control", "info", "-v"], + stderr=subprocess.PIPE).decode('utf-8').rstrip() except Exception: return 'N/A' @@ -109,9 +108,8 @@ def get_service(): service = 'wazuh-agent' else: # Linux, sunos5, darwin, aix... try: - output = subprocess.check_output([ - f"{WAZUH_PATH}/bin/wazuh-control", "info", "-t" - ], stderr=subprocess.PIPE).decode('utf-8').strip() + output = subprocess.check_output([f"{WAZUH_PATH}/bin/wazuh-control", "info", "-t"], + stderr=subprocess.PIPE).decode('utf-8').strip() service = 'wazuh-manager' if service == 'server' else 'wazuh-agent' except Exception: service = 'N/A' diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 32a2f812d3..4a2b67dc17 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -318,6 +318,7 @@ def pytest_addoption(parser): help="Avoid tests deselection based on current environment" ) + def pytest_configure(config): # Register an additional marker config.addinivalue_line( @@ -390,7 +391,6 @@ def pytest_configure(config): global_parameters.avoid_platform_based_deselection = config.getoption("--avoid-platform-based-deselection") - def pytest_html_results_table_header(cells): cells.insert(4, html.th('Tier', class_='sortable tier', col='tier')) cells.insert(3, html.th('Markers')) diff --git a/tests/integration/test_agentd/test_agentd_parametrized_reconnections.py b/tests/integration/test_agentd/test_agentd_parametrized_reconnections.py index 8e0784cf3a..c9bc47d1fb 100644 --- a/tests/integration/test_agentd/test_agentd_parametrized_reconnections.py +++ b/tests/integration/test_agentd/test_agentd_parametrized_reconnections.py @@ -255,6 +255,7 @@ def wait_unable_to_connect(line): return line return None + @pytest.fixture(scope="module") def change_timeout(): """Set agent.recv_timeout for agentd in local internal options file. diff --git a/tests/integration/test_agentd/test_agentd_reconnection.py b/tests/integration/test_agentd/test_agentd_reconnection.py index 91955f9a0c..f16a23fb05 100644 --- a/tests/integration/test_agentd/test_agentd_reconnection.py +++ b/tests/integration/test_agentd/test_agentd_reconnection.py @@ -103,6 +103,7 @@ def teardown(): if remoted_server is not None: remoted_server.stop() + @pytest.fixture(scope="module", autouse=True) def set_debug_mode(): """Set debug2 for agentd in local internal options file.""" diff --git a/tests/integration/test_gcloud/test_functionality/test_interval.py b/tests/integration/test_gcloud/test_functionality/test_interval.py index 6dc2d6ec78..64e4e2b923 100644 --- a/tests/integration/test_gcloud/test_functionality/test_interval.py +++ b/tests/integration/test_gcloud/test_functionality/test_interval.py @@ -94,8 +94,8 @@ configurations = load_wazuh_configurations(configurations_path, __name__, params=p, metadata=m) -# Preparing +# Preparing @pytest.fixture(scope='module', autouse=True) def truncate_logs(): """Truncate the 'ossec.log' file.""" @@ -181,4 +181,4 @@ def test_interval(get_configuration, configure_environment, reset_ossec_log, dae '"Starting fetching of logs" event').result() end_time = time.time() diff_time = int(end_time - start_time) - assert time_interval - diff_time <= 10 \ No newline at end of file + assert time_interval - diff_time <= 10 diff --git a/tests/integration/test_gcloud/test_functionality/test_max_messages.py b/tests/integration/test_gcloud/test_functionality/test_max_messages.py index 4402ced11b..1bd3221e18 100644 --- a/tests/integration/test_gcloud/test_functionality/test_max_messages.py +++ b/tests/integration/test_gcloud/test_functionality/test_max_messages.py @@ -95,8 +95,8 @@ configurations = load_wazuh_configurations(configurations_path, __name__, params=p, metadata=m) -# Preparing +# Preparing @pytest.fixture(scope='module', autouse=True) def truncate_logs(): """Truncate the 'ossec.log' file.""" diff --git a/tests/integration/test_gcloud/test_functionality/test_rules.py b/tests/integration/test_gcloud/test_functionality/test_rules.py index b4333e6e93..52a9e32b40 100644 --- a/tests/integration/test_gcloud/test_functionality/test_rules.py +++ b/tests/integration/test_gcloud/test_functionality/test_rules.py @@ -97,8 +97,8 @@ def truncate_logs(): """Truncate the 'ossec.log' file.""" truncate_file(LOG_FILE_PATH) -# fixtures +# fixtures @pytest.fixture(scope='module', params=configurations) def get_configuration(request): """Get configurations from the module.""" diff --git a/tests/integration/test_integratord/test_integratord_read_json_alerts.py b/tests/integration/test_integratord/test_integratord_read_json_alerts.py index 0522daa4bb..e667e493c1 100644 --- a/tests/integration/test_integratord/test_integratord_read_json_alerts.py +++ b/tests/integration/test_integratord/test_integratord_read_json_alerts.py @@ -144,7 +144,8 @@ def test_integratord_read_valid_alerts(configuration, metadata, replace_configur @pytest.mark.tier(level=1) @pytest.mark.parametrize('configuration, metadata', zip(t2_configurations, t2_configuration_metadata), ids=t2_case_ids) -def test_integratord_read_invalid_alerts(configuration, metadata, replace_configuration_api_key, set_wazuh_configuration, truncate_monitored_files, +def test_integratord_read_invalid_alerts(configuration, metadata, replace_configuration_api_key, + set_wazuh_configuration, truncate_monitored_files, configure_local_internal_options_module, restart_wazuh_daemon_function, wait_for_start_module): ''' diff --git a/tests/integration/test_wpk/test_wpk_agent.py b/tests/integration/test_wpk/test_wpk_agent.py index e9c52fa795..b64e870c5a 100644 --- a/tests/integration/test_wpk/test_wpk_agent.py +++ b/tests/integration/test_wpk/test_wpk_agent.py @@ -508,7 +508,7 @@ def test_wpk_agent(get_configuration, prepare_agent_version, download_wpk, remoted_simulator.change_default_listener = True event = wazuh_log_monitor.start(timeout=timeout_ack_response, error_message='ACK event not received', - callback=callback_detect_upgrade_ack_event).result() + callback=callback_detect_upgrade_ack_event).result() result = event['parameters'] if result is not None: diff --git a/tests/integration/test_wpk/test_wpk_manager.py b/tests/integration/test_wpk/test_wpk_manager.py index bfcac57ba0..e311841d65 100644 --- a/tests/integration/test_wpk/test_wpk_manager.py +++ b/tests/integration/test_wpk/test_wpk_manager.py @@ -87,8 +87,6 @@ time_until_ask_upgrade_result = 30 max_upgrade_result_status_retries = 30 - - version_to_upgrade = global_parameters.wpk_version[0] if global_parameters.wpk_version else 'v4.4.0' MANAGER_VERSION = get_version() diff --git a/tests/integration/test_wpk/test_wpk_manager_task_states.py b/tests/integration/test_wpk/test_wpk_manager_task_states.py index a84e7a87de..f6874ce6cb 100644 --- a/tests/integration/test_wpk/test_wpk_manager_task_states.py +++ b/tests/integration/test_wpk/test_wpk_manager_task_states.py @@ -424,10 +424,9 @@ def test_wpk_manager_task_states(get_configuration, configure_environment, # Chech that result of first attempt is Success assert new_expected_response[agents_id.index(agent_id)] == \ - response['data'][0]['message'], \ - f'New upgrade response did not match expected! ' \ - f'Expected {new_expected_response} obtained ' \ - f'{response["data"][0]["message"]}' + response['data'][0]['message'], f'New upgrade response did not match expected! ' \ + f'Expected {new_expected_response} obtained ' \ + f'{response["data"][0]["message"]}' for injector in injectors: injector.stop_receive() diff --git a/tests/performance/test_api/conftest.py b/tests/performance/test_api/conftest.py index f745964c04..f3b11884b2 100755 --- a/tests/performance/test_api/conftest.py +++ b/tests/performance/test_api/conftest.py @@ -110,7 +110,8 @@ def pytest_html_results_table_row(report, cells): cells[2] = HTMLStyle.colored_td(report.user_properties[0][1]) cells[3] = HTMLStyle.colored_td(str(report.user_properties[2][1])) cells.append(HTMLStyle.colored_td(str(report.user_properties[3][1]))) - cells.append(HTMLStyle.colored_td(u'\u2713' if len(report.user_properties) > 4 and report.user_properties[4][1] else '')) + cells.append(HTMLStyle.colored_td(u'\u2713' if len(report.user_properties) > 4 and report.user_properties[4][1] + else '')) cells.append(HTMLStyle.colored_td(f'{report.duration:.3f} s')) except AttributeError: