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

Fix handling of one_manager_agent_env pytest marker in System tests #4782

Merged
merged 6 commits into from
Dec 20, 2023

Conversation

Deblintrake09
Copy link
Contributor

@Deblintrake09 Deblintrake09 commented Dec 19, 2023

Related issue
closes #4763

Description

This PR fixes the system tests so that it generates reports correctly when the test has the cluster and one_manager_agent_env markers.

Updated

  • tests/system/conftest.py

Testing performed

  • executed tests with marker command # python3 -m pytest -m one_manager_agent_env -vvv --html=/home/qa/one_manager_agent.html
# python3 -m pytest -m one_manager_agent_env -vvv --html=/home/qa/one_manager_agent.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-6.6.6-76060606-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/qa/Descargas/wazuh-qa/tests/system, configfile: pytest.ini
plugins: html-3.1.1, testinfra-5.0.0, metadata-3.0.0
collected 192 items / 165 deselected / 27 selected                                                                                                                                                         

test_cluster/test_correct_merged_file_generation/test_correct_merged_file_generation.py::test_correct_merged_file_generation[merged_created_on_start] PASSED                                         [  3%]
test_cluster/test_correct_merged_file_generation/test_correct_merged_file_generation.py::test_correct_merged_file_generation[merged_updated_10_sec] PASSED                                           [  7%]
test_cluster/test_correct_merged_file_generation/test_correct_merged_file_generation.py::test_correct_merged_file_generation[add_non_zero_file_default_folder_check_merged_created_starts] PASSED    [ 11%]
test_cluster/test_correct_merged_file_generation/test_correct_merged_file_generation.py::test_correct_merged_file_generation[add_zero_file_default_folder_check_merged_created_starts] PASSED        [ 14%]
test_cluster/test_correct_merged_file_generation/test_correct_merged_file_generation.py::test_correct_merged_file_generation[add_non_zero_size_file_default_folder_check_merged_updated_10_sec0] PASSED [ 18%]
test_cluster/test_correct_merged_file_generation/test_correct_merged_file_generation.py::test_correct_merged_file_generation[add_non_zero_size_file_TestGroup1_folder_check_merged_updated_manager_starts] PASSED [ 22%]
test_cluster/test_correct_merged_file_generation/test_correct_merged_file_generation.py::test_correct_merged_file_generation[add_non_zero_size_file_TestGroup1_folder_check_merged_updated_10_sec] PASSED [ 25%]
test_cluster/test_correct_merged_file_generation/test_correct_merged_file_generation.py::test_correct_merged_file_generation[add_non_zero_size_file_default_folder_check_merged_updated_10_sec1] PASSED [ 29%]
test_cluster/test_correct_merged_file_generation/test_correct_merged_file_generation.py::test_correct_merged_file_generation[add_zero_size_file_TestGroup1_folder_check_merged_updated_manager_starts] PASSED [ 33%]
test_cluster/test_correct_merged_file_generation/test_correct_merged_file_generation.py::test_correct_merged_file_generation[add_zero_size_file_TestGroup1_folder_check_merged_updated_10_sec] PASSED [ 37%]
test_cluster/test_correct_merged_file_generation/test_correct_merged_file_generation.py::test_correct_merged_file_generation[add_serveral_zero_size_file_default_folder_check_merged_updated_manager_starts] PASSED [ 40%]
test_cluster/test_correct_merged_file_generation/test_correct_merged_file_generation.py::test_correct_merged_file_generation[add_serveral_zero_size_file_TestGroup1_folder_check_merged_updated_manager_start] PASSED [ 44%]
test_fim/test_files/test_files_cud.py::test_file_cud[testdir1-add] PASSED                                                                                                                            [ 48%]
test_fim/test_files/test_files_cud.py::test_file_cud[testdir1-modify] PASSED                                                                                                                         [ 51%]
test_fim/test_files/test_files_cud.py::test_file_cud[testdir1-delete] PASSED                                                                                                                         [ 55%]
test_fim/test_files/test_files_cud.py::test_file_cud[testdir2-add] PASSED                                                                                                                            [ 59%]
test_fim/test_files/test_files_cud.py::test_file_cud[testdir2-modify] PASSED                                                                                                                         [ 62%]
test_fim/test_files/test_files_cud.py::test_file_cud[testdir2-delete] PASSED                                                                                                                         [ 66%]
test_fim/test_files/test_files_cud.py::test_file_cud[testdir3-add] PASSED                                                                                                                            [ 70%]
test_fim/test_files/test_files_cud.py::test_file_cud[testdir3-modify] PASSED                                                                                                                         [ 74%]
test_fim/test_files/test_files_cud.py::test_file_cud[testdir3-delete] PASSED                                                                                                                         [ 77%]
test_fim/test_synchronization/test_synchronization.py::test_synchronization[testdir1-add-wazuh-agent1] PASSED                                                                                        [ 81%]
test_fim/test_synchronization/test_synchronization.py::test_synchronization[testdir1-add-wazuh-manager] PASSED                                                                                       [ 85%]
test_fim/test_synchronization/test_synchronization.py::test_synchronization[testdir1-modify-wazuh-agent1] PASSED                                                                                     [ 88%]
test_fim/test_synchronization/test_synchronization.py::test_synchronization[testdir1-modify-wazuh-manager] PASSED                                                                                    [ 92%]
test_fim/test_synchronization/test_synchronization.py::test_synchronization[testdir1-delete-wazuh-agent1] PASSED                                                                                     [ 96%]
test_fim/test_synchronization/test_synchronization.py::test_synchronization[testdir1-delete-wazuh-manager] PASSED                                                                                    [100%]
----------------------------------------------------------------------- generated html file: file:///home/qa/one_manager_agent.html ------------------------------------------------------------------------
======================================================================= 27 passed, 165 deselected, 5 warnings in 1750.91s (0:29:10) ========================================================================
Tester Test path Local OS Commit Notes
@Deblintrake09 (Developer) tests/system/ 🟢 Ubuntu a8b0ed9 Nothing to highlight
@pro-akim (Reviewer) 🟢 ⚫⚫ Nothing to highlight

Copy link
Member

@Rebits Rebits left a comment

Choose a reason for hiding this comment

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

GJ, minor changes are requested

@@ -126,7 +126,7 @@ def pytest_runtest_makereport(item, call):
arguments[key] = str(value)
extra.append(pytest_html.extras.json(arguments, name="Test arguments"))

if "cluster" in report.markers:
if "cluster" in report.markers and "one_manager_agent_env" not in report.markers:
Copy link
Member

Choose a reason for hiding this comment

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

Why does one_manager_agent_env include the cluster marker? It seems that removing the marker would result in a more maintainable approach for this particular case.

In addition, handling the logs from cluster environment using markers is not the best approach. We should consider to change this logic in order to make it more error resistant, including a minor inventory validation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in 0baa8e3

CHANGELOG.md Outdated
@@ -17,6 +17,7 @@ All notable changes to this project will be documented in this file.

### Changed

- Fix one_manager_agent_env pytest marker for System Tests ([#4763](https://github.com/wazuh/wazuh-qa/pull/4763)) \- (Tests)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- Fix one_manager_agent_env pytest marker for System Tests ([#4763](https://github.com/wazuh/wazuh-qa/pull/4763)) \- (Tests)
- Fix one_manager_agent_env pytest marker for System Tests ([#4782](https://github.com/wazuh/wazuh-qa/pull/4782)) \- (Tests)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 0d43995

@Deblintrake09 Deblintrake09 changed the title fix: handle one_manager_env marker Fix handling of one_manager_agent_env pytest marker in System tests Dec 19, 2023
pro-akim
pro-akim previously approved these changes Dec 20, 2023
Copy link
Member

@pro-akim pro-akim left a comment

Choose a reason for hiding this comment

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

Review Notes

LGTM

@davidjiglesias davidjiglesias merged commit 45a2a89 into 4.8.0 Dec 20, 2023
2 of 3 checks passed
@davidjiglesias davidjiglesias deleted the enhancement/4763-fix-onemanager-agent-env-tests branch December 20, 2023 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants