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

Add localfile wildcard support for windows IT #4263

Merged
merged 11 commits into from
Jul 28, 2023

Conversation

Deblintrake09
Copy link
Contributor

@Deblintrake09 Deblintrake09 commented Jul 3, 2023

Related issue
#3786

Description

This PR adds test support for wildcards usage in the localfile location tag for Windows agents.

Added

  • Added 6 test cases in /test_logcollector/test_location_wildcards suite. Testing different wildcards combinations and a case where wildcards do not match a valid file

Testing performed

Tester Test path Jenkins Local OS Commit Notes
@Deblintrake09 (Developer) test_logcollector 🟢🟢🟢 Manager 1536dd8 Nothing to highlight
@Deblintrake09 (Developer) test_logcollector 🟢🟢🟢 Linux agent 1536dd8 Nothing to highlight
@Deblintrake09 (Developer) test_logcollector 🟢🟢🟢 Windows agent 1536dd8 Nothing to highlight
@damarisg (Reviewer) test_logcollector 🟢 🚫 🚫 🚫 Manager ae13d71 Nothing to highlight
@damarisg (Reviewer) test_logcollector 🟢 🚫 🚫 🚫 Linux agent ae13d71 Nothing to highlight
@damarisg (Reviewer) test_logcollector 🟢 🚫 🚫 🚫 Windows agent ae13d71 Nothing to highlight
@damarisg (Reviewer) test_logcollector 🟢 🚫 🚫 🚫 Solaris and macOS agent ae13d71 Nothing to highlight
@Deblintrake09 (Developer) test_logcollector 🟢 Manager 5de9cca Additional results after moving test to new folder
@Deblintrake09 (Developer) test_logcollector 🟢 Linux agent 5de9cca Additional results after moving test to new folder
@Deblintrake09 (Developer) test_logcollector 🟢 Windows agent 5de9cca Additional results after moving test to new folder

@Deblintrake09 Deblintrake09 self-assigned this Jul 3, 2023
@Deblintrake09 Deblintrake09 changed the title 3786 location wildcards Add localfile wildcard support for windows IT Jul 3, 2023
juliamagan
juliamagan previously approved these changes Jul 3, 2023
Copy link
Member

@juliamagan juliamagan left a comment

Choose a reason for hiding this comment

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

LGTM

@juliamagan juliamagan dismissed their stale review July 3, 2023 14:36

One check failed

@jnasselle jnasselle self-requested a review July 25, 2023 19:42
Copy link
Member

@jnasselle jnasselle left a comment

Choose a reason for hiding this comment

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

Also it seems to be some problems loading configurations.

============================= test session starts ==============================
platform linux -- Python 3.10.9, pytest-7.1.2, pluggy-1.0.0 -- /bin/python3
cachedir: .pytest_cache
metadata: {'Python': '3.10.9', 'Platform': 'Linux-3.10.0-1160.81.1.el7.x86_64-x86_64-with-glibc2.17', 'Packages': {'pytest': '7.1.2', 'pluggy': '1.0.0'}, 'Plugins': {'testinfra': '5.0.0', 'metadata': 
'2.0.4', 'html': '3.1.1'}}
rootdir: /tmp/Test_integration_B41699_20230726122239/tests/integration, configfile: pytest.ini
plugins: testinfra-5.0.0, metadata-2.0.4, html-3.1.1
collecting ... collected 631 items / 4 errors / 97 deselected / 534 selected

==================================== ERRORS ====================================
_ ERROR collecting test_logcollector/test_configuration/test_basic_configuration_ignore_binaries.py _
test_logcollector/test_configuration/test_basic_configuration_ignore_binaries.py:91: in <module>
    prefix = LOG_COLLECTOR_DETECTOR_PREFIX
E   NameError: name 'LOG_COLLECTOR_DETECTOR_PREFIX' is not defined
______ ERROR collecting test_logcollector/test_location/test_location.py _______
test_logcollector/test_location/test_location.py:187: in <module>
    configurations = load_wazuh_configurations(configurations_path, __name__, params=parameters, metadata=metadata)
/usr/local/python-3.10/lib/python3.10/site-packages/wazuh_testing-4.6.0-py3.10.egg/wazuh_testing/tools/configuration.py:446: in load_wazuh_configurations
    with open(yaml_file_path) as stream:
E   FileNotFoundError: [Errno 2] No such file or directory: '/tmp/Test_integration_B41699_20230726122239/tests/integration/test_logcollector/test_location/data/configuration_template/configuration_loc
ation.yaml'
__ ERROR collecting test_logcollector/test_location/test_location_exclude.py ___
test_logcollector/test_location/test_location_exclude.py:187: in <module>
    configurations = load_wazuh_configurations(configurations_path, __name__, params=parameters, metadata=metadata)
/usr/local/python-3.10/lib/python3.10/site-packages/wazuh_testing-4.6.0-py3.10.egg/wazuh_testing/tools/configuration.py:446: in load_wazuh_configurations
    with open(yaml_file_path) as stream:
E   FileNotFoundError: [Errno 2] No such file or directory: '/tmp/Test_integration_B41699_20230726122239/tests/integration/test_logcollector/test_location/data/configuration_template/configuration_loc
ation.yaml'
_ ERROR collecting test_logcollector/test_location/test_win_location_wildcards.py _
test_logcollector/test_location/test_win_location_wildcards.py:69: in <module>
    configurations = load_configuration_template(configurations_path, configuration_parameters,
/usr/local/python-3.10/lib/python3.10/site-packages/wazuh_testing-4.6.0-py3.10.egg/wazuh_testing/tools/configuration.py:696: in load_configuration_template
    configuration = file.read_yaml(data_file_path)
/usr/local/python-3.10/lib/python3.10/site-packages/wazuh_testing-4.6.0-py3.10.egg/wazuh_testing/tools/file.py:61: in read_yaml
    with open(file_path) as f:
E   FileNotFoundError: [Errno 2] No such file or directory: '/tmp/Test_integration_B41699_20230726122239/tests/integration/test_logcollector/test_location/data/configuration_template/configuration_win
_location_wildcards.yaml'
- generated html file: file:///tmp/Test_integration_B41699_20230726122239/report.html -
=========================== short test summary info ============================
ERROR test_logcollector/test_configuration/test_basic_configuration_ignore_binaries.py
ERROR test_logcollector/test_location/test_location.py - FileNotFoundError: [...
ERROR test_logcollector/test_location/test_location_exclude.py - FileNotFound...
ERROR test_logcollector/test_location/test_win_location_wildcards.py - FileNo...
!!!!!!!!!!!!!!!!!!! Interrupted: 4 errors during collection !!!!!!!!!!!!!!!!!!!!
======================= 97 deselected, 4 errors in 9.30s =======================

@jnasselle jnasselle removed the request for review from damarisg July 27, 2023 11:56
Copy link
Member

@juliamagan juliamagan left a comment

Choose a reason for hiding this comment

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

LGTM

@davidjiglesias davidjiglesias merged commit 91bf408 into 4.6.0 Jul 28, 2023
4 checks passed
@davidjiglesias davidjiglesias deleted the 3786-location-wildcards branch July 28, 2023 06:25
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.

Add log monitoring using wildcards for folders on Windows IT Support
4 participants