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

Added new case to test_basic_usage_changes to check wildcards #1009

Merged
merged 3 commits into from
Feb 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,19 @@
attributes:
- check_all: 'yes'
- FIM_MODE

# conf 2
- tags:
- ossec_conf_wildcards
apply_to_modules:
- MODULE_NAME
sections:
- section: syscheck
elements:
- disabled:
value: 'no'
- directories:
value: TEST_WILDCARDS
attributes:
- check_all: 'yes'
- FIM_MODE
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@
configurations_path = os.path.join(test_data_path, 'wazuh_conf.yaml')
testdir1, testdir2 = test_directories


# configurations

conf_params = {'TEST_DIRECTORIES': directory_str, 'MODULE_NAME': __name__}
conf_params = {'TEST_DIRECTORIES': directory_str, 'TEST_WILDCARDS': os.path.join(PREFIX, 'testdir?'),
'MODULE_NAME': __name__}
p, m = generate_params(extra_params=conf_params)
configurations = load_wazuh_configurations(configurations_path, __name__, params=p, metadata=m)

Expand All @@ -51,19 +53,23 @@ def get_configuration(request):
@pytest.mark.parametrize('name, encoding, checkers, tags_to_apply', [
('regular0', None, {CHECK_ALL}, {'ossec_conf'}),
pytest.param('檔案', 'cp950', {CHECK_ALL}, {'ossec_conf'}, marks=(pytest.mark.linux,
pytest.mark.darwin, pytest.mark.sunos5)),
pytest.mark.darwin,
pytest.mark.sunos5)),
pytest.param('Образецтекста', 'koi8-r', {CHECK_ALL}, {'ossec_conf'}, marks=(pytest.mark.linux,
pytest.mark.darwin,
pytest.mark.sunos5)),
pytest.param('Δείγμακειμένου', 'cp737', {CHECK_ALL}, {'ossec_conf'}, marks=(pytest.mark.linux,
pytest.mark.darwin,
pytest.mark.sunos5)),
pytest.param('نصبسيط', 'cp720', {CHECK_ALL}, {'ossec_conf'}, marks=(pytest.mark.linux,
pytest.mark.darwin, pytest.mark.sunos5)),
pytest.param('Ξ³ΞµΞΉΞ±', None, {CHECK_ALL}, {'ossec_conf'},
marks=(pytest.mark.win32,
pytest.mark.xfail(reason='Xfail due to issue: https:/wazuh/wazuh/issues/4612')))

pytest.mark.darwin,
pytest.mark.sunos5)),
pytest.param('Ξ³ΞµΞΉΞ±', None, {CHECK_ALL}, {'ossec_conf'}, marks=(pytest.mark.win32,
pytest.mark.xfail(reason='Xfail due to issue: \
https:/wazuh/wazuh/issues/4612'))),
pytest.param('regular1', None, {CHECK_ALL}, {'ossec_conf_wildcards'}, marks=(pytest.mark.linux,
pytest.mark.darwin,
pytest.mark.sunos5))
])
def test_regular_file_changes(folder, name, encoding, checkers, tags_to_apply,
get_configuration, configure_environment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from wazuh_testing.tools import PREFIX
from wazuh_testing.tools.monitoring import FileMonitor
from wazuh_testing.fim import LOG_FILE_PATH, generate_params, regular_file_cud
from wazuh_testing.tools.configuration import load_wazuh_configurations
from wazuh_testing.tools.configuration import load_wazuh_configurations, check_apply_test

# Marks
pytestmark = pytest.mark.tier(level=2)
Expand Down Expand Up @@ -52,6 +52,8 @@ def test_directories_with_commas(directory, get_configuration, put_env_variables
"""
Test alerts are generated when monitor environment variables
"""
check_apply_test({'ossec_conf'}, get_configuration['tags'])

regular_file_cud(directory, wazuh_log_monitor, file_list=["testing_env_variables"],
min_timeout=global_parameters.default_timeout,
time_travel=get_configuration['metadata']['fim_mode'] == 'scheduled')