From 3cbdaaf7c148c1fcf96f75af6d1e119dc1905108 Mon Sep 17 00:00:00 2001 From: Francisco Tuduri Date: Wed, 27 Sep 2023 17:04:15 -0300 Subject: [PATCH 1/2] fix: Align migration tool tests to new output directory structure --- .../wazuh_testing/tools/migration_tool/__init__.py | 5 +++-- .../wazuh_testing/tools/migration_tool/utils.py | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/deps/wazuh_testing/wazuh_testing/tools/migration_tool/__init__.py b/deps/wazuh_testing/wazuh_testing/tools/migration_tool/__init__.py index 206bef1338..1b9e8ebf79 100644 --- a/deps/wazuh_testing/wazuh_testing/tools/migration_tool/__init__.py +++ b/deps/wazuh_testing/wazuh_testing/tools/migration_tool/__init__.py @@ -11,8 +11,9 @@ DELTA_SCHEMA_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'delta_schema.json') WORKING_DIR = '/var/wazuh' MIGRATION_TOOL_PATH = f"{WORKING_DIR}/bin/content_migration" -MIGRATION_TOOL_LOG_PATH = f"{WORKING_DIR}/logs/content_migration.log" -GENERATED_FILES_DIR = f"{WORKING_DIR}/incoming" +MIGRATION_TOOL_OUTPUT_PATH = f"{WORKING_DIR}/output" +MIGRATION_TOOL_LOG_PATH = f"{MIGRATION_TOOL_OUTPUT_PATH}/logs/migration.log" +GENERATED_FILES_DIR = f"{MIGRATION_TOOL_OUTPUT_PATH}/migration" SNAPSHOTS_DIR = f"{GENERATED_FILES_DIR}/snapshots" DOWNLOADS_DIR = f"{GENERATED_FILES_DIR}/downloads" UNCOMPRESSED_DIR = f"{GENERATED_FILES_DIR}/uncompressed" diff --git a/deps/wazuh_testing/wazuh_testing/tools/migration_tool/utils.py b/deps/wazuh_testing/wazuh_testing/tools/migration_tool/utils.py index 6f149226ac..4467f4d821 100644 --- a/deps/wazuh_testing/wazuh_testing/tools/migration_tool/utils.py +++ b/deps/wazuh_testing/wazuh_testing/tools/migration_tool/utils.py @@ -32,7 +32,9 @@ def run_content_migration_tool(configuration_file_path, args=''): error (str): Error output if the execution fails. """ - truncate_file(migration_tool.MIGRATION_TOOL_LOG_PATH) + if os.path.exists(migration_tool.MIGRATION_TOOL_LOG_PATH): + truncate_file(migration_tool.MIGRATION_TOOL_LOG_PATH) + command = ' '.join([migration_tool.MIGRATION_TOOL_PATH, '-i', str(configuration_file_path), args]) proc = sbp.Popen(command, shell=True, stdout=sbp.PIPE, stderr=sbp.PIPE) out, error = proc.communicate() From 0c19d2e49d712edb831ea1007c637206796e060c Mon Sep 17 00:00:00 2001 From: Francisco Tuduri Date: Wed, 27 Sep 2023 17:10:50 -0300 Subject: [PATCH 2/2] docs: updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b1aeaaad2..d8d9b8eed6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ Release report: TBD - Update _wazuh_db_ schema database version ([#4353](https://github.com/wazuh/wazuh-qa/pull/4353)) \- (Tests) - Update the JSON schema with the required fields for the output content of the migration tool ([#4375](https://github.com/wazuh/wazuh-qa/pull/4375)) \- (Tests) - Update framework known flaws file ([#4443](https://github.com/wazuh/wazuh-qa/pull/4443)) \- (Tests) +- Align migration tool system tests to the tool's new output directory structure ([#4561](https://github.com/wazuh/wazuh-qa/pull/4561)) \- (Tests) ## [4.7.1] - TBD