Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align migration tool tests to new output directory structure #4561

Conversation

jftuduri
Copy link
Member

@jftuduri jftuduri commented Sep 27, 2023

Related issue
Closes #4560

Description

This PR updates the system test of the migration tool by aligning the test's expected output files to the tool's new output directory structure.


Testing performed

System tests work correctly

ft@ft-nb:~/wazuh/repos/dev/intelligence-platform-tests/qa$ python3 -m pytest -vvv tests/end_to_end/ --html=e2e-report.html --self-contained-html
============================================================ test session starts =============================================================
platform linux -- Python 3.10.12, pytest-7.4.0, pluggy-1.3.0 -- /usr/bin/python3
cachedir: .pytest_cache
metadata: {'Python': '3.10.12', 'Platform': 'Linux-5.15.0-53-generic-x86_64-with-glibc2.35', 'Packages': {'pytest': '7.4.0', 'pluggy': '1.3.0'}, 'Plugins': {'metadata': '2.0.4', 'testinfra': '5.0.0', 'html': '3.1.1'}}
rootdir: /home/ft/wazuh/repos/dev/intelligence-platform-tests/qa
configfile: pytest.ini
plugins: metadata-2.0.4, testinfra-5.0.0, html-3.1.1
collected 22 items                                                                                                                           

tests/end_to_end/test_feed_ingestion/test_invalid_inputs.py::test_invalid_inputs[EMPTY_FEED] PASSED                                    [  4%]
tests/end_to_end/test_feed_ingestion/test_invalid_inputs.py::test_invalid_inputs[NOT_SUPPORTED_FORMAT_FEED] PASSED                     [  9%]
tests/end_to_end/test_feed_ingestion/test_invalid_inputs.py::test_invalid_inputs[INVALID_JSON_FEED] PASSED                             [ 13%]
tests/end_to_end/test_feed_ingestion/test_invalid_inputs.py::test_invalid_inputs[INVALID_XML_FEED] PASSED                              [ 18%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_complete_migration[ALAS1_FEED] PASSED                                  [ 22%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_complete_migration[ALAS2_FEED] PASSED                                  [ 27%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_complete_migration[ALAS2022_FEED] PASSED                               [ 31%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_complete_migration[ALAS2023_FEED] PASSED                               [ 36%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_complete_migration[ARCH_LINUX_FEED] PASSED                             [ 40%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_complete_migration[DEBIAN_FEED] PASSED                                 [ 45%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_complete_migration[NVD_FEED] PASSED                                    [ 50%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_complete_migration[REDHAT_FEED] PASSED                                 [ 54%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_complete_migration[SUSE_FEED] PASSED                                   [ 59%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_complete_migration[ALMALINUX_FEED] PASSED                              [ 63%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_complete_migration[CANONICAL_FEED] PASSED                              [ 68%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_insertion_and_update_delta[ARCH_VULNERABILITY_ADDED] PASSED            [ 72%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_insertion_and_update_delta[ARCH_VULNERABILITY_UPDATED] PASSED          [ 77%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_delta_schema[ARCH_DELTA_INSERT_SCHEMA_VALIDATION] PASSED               [ 81%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_delta_schema[ARCH_DELTA_UPDATE_SCHEMA_VALIDATION] PASSED               [ 86%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_delta_schema[ARCH_DELTA_DELETE_SCHEMA_VALIDATION] PASSED               [ 90%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_elimination_delta[ARCH_VULNERABILITY_REMOVED] PASSED                   [ 95%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_skip_migration[SKIP_MIGRATION_PROCESS] PASSED                          [100%]

-------------------- generated html file: file:///home/ft/wazuh/repos/dev/intelligence-platform-tests/qa/e2e-report.html ---------------------
======================================================= 22 passed in 293.75s (0:04:53) =======================================================

System Tests Pipeline (Docker) works correctly

ft@ft-nb:~/wazuh/repos/dev/intelligence-platform-tests$ python3 qa/system_tests_launcher.py
SYSTEM-TESTS-LAUNCHER: [INFO] Creating the output folder at: /tmp/system_tests_results
SYSTEM-TESTS-LAUNCHER: [INFO] Building Docker image.
SYSTEM-TESTS-LAUNCHER: [INFO] Docker image built successfully.
SYSTEM-TESTS-LAUNCHER: [INFO] Running container that contains the pipeline script to be executed.
SYSTEM-TESTS-LAUNCHER: [INFO] Parameters for the pipeline: --env dev 
SYSTEM-TESTS-LAUNCHER: [INFO] Removing the build directory in order to build the system from scratch.
SYSTEM-TESTS-LAUNCHER: [INFO] The '/home/ft/wazuh/repos/dev/intelligence-platform-tests/build' directory was removed.
->Step: SERVICES: Starting the services required by the tool.
->Step: SERVICES: Starting service -> mysql_migration_tool
->Step: SERVICES: The service mysql_migration_tool is running correctly.
->Step: BUILD: The build process began.
->Step: BUILD: The `build` folder has been created successfully.
->Step: BUILD: The tool has been compiled successfully.
->Step: BUILD: The executables and libraries have been built successfully.
->Step: INSTALLATION: Installing the built tool.
->Step: INSTALLATION: The tool was installed successfully.
->Step: TESTS: Running tests.
->Step: TESTS: The tests have passed. Results: 22 passed in 262.64s (0:04:22) 
SYSTEM-TESTS-LAUNCHER: [INFO] Pipeline execution finished. Results in: /tmp/system_tests_results
SYSTEM-TESTS-LAUNCHER: [INFO] Removing container.
SYSTEM-TESTS-LAUNCHER: [INFO] The Docker container called `intelligence-system-tests` was removed.

@jftuduri jftuduri self-assigned this Sep 27, 2023
@jftuduri jftuduri marked this pull request as ready for review September 27, 2023 20:27
Copy link
Contributor

@tsarquis88 tsarquis88 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

# python3 -m pytest qa/tests/end_to_end/ --env dev
==================================================================================== test session starts =====================================================================================
platform linux -- Python 3.10.12, pytest-7.1.2, pluggy-1.3.0
rootdir: /home/platform-main/qa, configfile: pytest.ini
plugins: metadata-3.0.0, html-3.1.1, testinfra-5.0.0
collected 22 items                                                                                                                                                                           

qa/tests/end_to_end/test_feed_ingestion/test_invalid_inputs.py ....                                                                                                                    [ 18%]
qa/tests/end_to_end/test_feed_ingestion/test_valid_inputs.py ..................                                                                                                        [100%]

=============================================================================== 22 passed in 236.51s (0:03:56) ===============================================================================
 % python3 qa/system_tests_launcher.py -k
SYSTEM-TESTS-LAUNCHER: [INFO] Creating the output folder at: /tmp/system_tests_results
SYSTEM-TESTS-LAUNCHER: [INFO] Building Docker image.
SYSTEM-TESTS-LAUNCHER: [INFO] Docker image built successfully.
SYSTEM-TESTS-LAUNCHER: [INFO] Running container that contains the pipeline script to be executed.
SYSTEM-TESTS-LAUNCHER: [INFO] Parameters for the pipeline: --env dev -k
->Step: SERVICES: Starting the services required by the tool.
->Step: SERVICES: Starting service -> mysql_migration_tool
->Step: SERVICES: The service mysql_migration_tool is running correctly.
->Step: BUILD: The build process was intended to be skipped, but the `build` folder does not exist.
->Step: BUILD: The build process began.
->Step: BUILD: The `build` folder has been created successfully.
->Step: BUILD: The tool has been compiled successfully.
->Step: BUILD: The executables and libraries have been built successfully.
->Step: INSTALLATION: Installing the built tool.
->Step: INSTALLATION: The tool was installed successfully.
->Step: TESTS: Running tests.
->Step: TESTS: The tests have passed. Results: 22 passed in 247.88s (0:04:07) 
SYSTEM-TESTS-LAUNCHER: [INFO] Pipeline execution finished. Results in: /tmp/system_tests_results
SYSTEM-TESTS-LAUNCHER: [INFO] Removing container.
SYSTEM-TESTS-LAUNCHER: [INFO] The Docker container called `intelligence-system-tests` was removed.

 % cat /tmp/system_tests_results/system_tests_results.txt 
============================= test session starts ==============================
platform linux -- Python 3.10.12, pytest-7.1.2, pluggy-1.3.0
rootdir: /source/qa, configfile: pytest.ini
plugins: metadata-3.0.0, html-3.1.1, testinfra-5.0.0
collected 22 items

tests/end_to_end/test_feed_ingestion/test_invalid_inputs.py ....         [ 18%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py .............. [ 81%]
....                                                                     [100%]

--------- generated html file: file:///output/system_tests_report.html ---------
======================== 22 passed in 247.88s (0:04:07) ========================

Copy link
Member

@Damian-Mangold Damian-Mangold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !

Copy link
Contributor

@kevin-mcm kevin-mcm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

> python3 -m pytest -vvv tests/end_to_end/ --html=e2e-report.html --self-contained-html
============================================================================================== test session starts ==============================================================================================
platform linux -- Python 3.10.12, pytest-7.1.2, pluggy-1.3.0 -- /usr/bin/python3
cachedir: .pytest_cache
metadata: {'Python': '3.10.12', 'Platform': 'Linux-5.15.0-84-generic-x86_64-with-glibc2.35', 'Packages': {'pytest': '7.1.2', 'pluggy': '1.3.0'}, 'Plugins': {'html': '3.1.1', 'testinfra': '5.0.0', 'metadata': '3.0.0'}}
rootdir: /home/server/intelligence-platform/qa, configfile: pytest.ini
plugins: html-3.1.1, testinfra-5.0.0, metadata-3.0.0
collected 22 items

tests/end_to_end/test_feed_ingestion/test_invalid_inputs.py::test_invalid_inputs[EMPTY_FEED] PASSED                                                                                                       [  4%]
tests/end_to_end/test_feed_ingestion/test_invalid_inputs.py::test_invalid_inputs[NOT_SUPPORTED_FORMAT_FEED] PASSED                                                                                        [  9%]
tests/end_to_end/test_feed_ingestion/test_invalid_inputs.py::test_invalid_inputs[INVALID_JSON_FEED] PASSED                                                                                                [ 13%]
tests/end_to_end/test_feed_ingestion/test_invalid_inputs.py::test_invalid_inputs[INVALID_XML_FEED] PASSED                                                                                                 [ 18%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_complete_migration[ALAS1_FEED] PASSED                                                                                                     [ 22%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_complete_migration[ALAS2_FEED] PASSED                                                                                                     [ 27%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_complete_migration[ALAS2022_FEED] PASSED                                                                                                  [ 31%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_complete_migration[ALAS2023_FEED] PASSED                                                                                                  [ 36%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_complete_migration[ARCH_LINUX_FEED] PASSED                                                                                                [ 40%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_complete_migration[DEBIAN_FEED] PASSED                                                                                                    [ 45%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_complete_migration[NVD_FEED] PASSED                                                                                                       [ 50%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_complete_migration[REDHAT_FEED] PASSED                                                                                                    [ 54%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_complete_migration[SUSE_FEED] PASSED                                                                                                      [ 59%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_complete_migration[ALMALINUX_FEED] PASSED                                                                                                 [ 63%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_complete_migration[CANONICAL_FEED] PASSED                                                                                                 [ 68%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_insertion_and_update_delta[ARCH_VULNERABILITY_ADDED] PASSED                                                                               [ 72%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_insertion_and_update_delta[ARCH_VULNERABILITY_UPDATED] PASSED                                                                             [ 77%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_delta_schema[ARCH_DELTA_INSERT_SCHEMA_VALIDATION] PASSED                                                                                  [ 81%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_delta_schema[ARCH_DELTA_UPDATE_SCHEMA_VALIDATION] PASSED                                                                                  [ 86%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_delta_schema[ARCH_DELTA_DELETE_SCHEMA_VALIDATION] PASSED                                                                                  [ 90%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_elimination_delta[ARCH_VULNERABILITY_REMOVED] PASSED                                                                                      [ 95%]
tests/end_to_end/test_feed_ingestion/test_valid_inputs.py::test_skip_migration[SKIP_MIGRATION_PROCESS] PASSED                                                                                             [100%]

--------------------------------------------------------------- generated html file: file:///home/server/intelligence-platform/qa/e2e-report.html ---------------------------------------------------------------
======================================================================================== 22 passed in 109.91s (0:01:49) =========================================================================================
> python3 qa/system_tests_launcher.py
SYSTEM-TESTS-LAUNCHER: [INFO] Creating the output folder at: /tmp/system_tests_results
SYSTEM-TESTS-LAUNCHER: [INFO] Building Docker image.
SYSTEM-TESTS-LAUNCHER: [INFO] Docker image built successfully.
SYSTEM-TESTS-LAUNCHER: [INFO] Running container that contains the pipeline script to be executed.
SYSTEM-TESTS-LAUNCHER: [INFO] Parameters for the pipeline: --env dev
SYSTEM-TESTS-LAUNCHER: [INFO] Removing the build directory in order to build the system from scratch.
SYSTEM-TESTS-LAUNCHER: [INFO] The '/home/server/intelligence-platform/build' directory was removed.
->Step: SERVICES: Starting the services required by the tool.
->Step: SERVICES: Starting service -> mysql_migration_tool
->Step: SERVICES: The service mysql_migration_tool is running correctly.
->Step: BUILD: The build process began.
->Step: BUILD: The `build` folder has been created successfully.
->Step: BUILD: The tool has been compiled successfully.
->Step: BUILD: The executables and libraries have been built successfully.
->Step: INSTALLATION: Installing the built tool.
->Step: INSTALLATION: The tool was installed successfully.
->Step: TESTS: Running tests.
->Step: TESTS: The tests have passed. Results: 22 passed in 146.24s (0:02:26)
SYSTEM-TESTS-LAUNCHER: [INFO] Pipeline execution finished. Results in: /tmp/system_tests_results
SYSTEM-TESTS-LAUNCHER: [INFO] Removing container.
SYSTEM-TESTS-LAUNCHER: [INFO] The Docker container called `intelligence-system-tests` was removed.

@Dwordcito Dwordcito merged commit 9c2ac34 into master Sep 29, 2023
7 checks passed
@Dwordcito Dwordcito deleted the dev-4560-update-migration-tool-system-tests-output-directory-structure branch September 29, 2023 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migration tool system tests are failing
5 participants