Skip to content

Commit

Permalink
style(#3480): fix indentation and spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
Deblintrake09 committed Dec 13, 2022
1 parent 9313265 commit 71219c7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@
regex1: .+regex1
regex2: .+regex2
log_sample: "Nov 10 12:19:04 localhost sshd: log does not matches"
matches: no match
matches: no match
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
log_sample: "Nov 10 12:19:04 localhost sshd: log matches regex2"
matches: regex2

- name: No match - Two Restrict tags
- name: No match - Two Restrict tags
description: Test two Restrict, log does not match
configuration_parameters:
REGEX_1: .+regex1
Expand All @@ -40,4 +40,4 @@
regex1: .+regex1
regex2: .+regex2
log_sample: "Nov 10 12:19:04 localhost sshd: log does not matches"
matches: no match
matches: no match
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

# Test configurations and cases data
test_file = os.path.join(PREFIX, 'test')
#---------------------------------TEST_IGNORE_DEFAULT--------------------------------------------
# --------------------------------TEST_IGNORE_DEFAULT--------------------------------------------
t1_configurations_path = os.path.join(CONFIGURATIONS_PATH, 'configuration_ignore_regex_default.yaml')
t1_cases_path = os.path.join(TEST_CASES_PATH, 'cases_ignore_regex_default.yaml')

Expand All @@ -80,7 +80,7 @@
t1_configurations = load_configuration_template(t1_configurations_path, t1_configuration_parameters,
t1_configuration_metadata)

#---------------------------------TEST_IGNORE_REGEX_TYPE_VALUES--------------------------------------
# --------------------------------TEST_IGNORE_REGEX_TYPE_VALUES--------------------------------------
t2_configurations_path = os.path.join(CONFIGURATIONS_PATH, 'configuration_ignore_regex_type_values.yaml')
t2_cases_path = os.path.join(TEST_CASES_PATH, 'cases_ignore_regex_type_values.yaml')

Expand All @@ -90,7 +90,7 @@
t2_configurations = load_configuration_template(t2_configurations_path, t2_configuration_parameters,
t2_configuration_metadata)

#---------------------------------TEST_IGNORE_MULTIPLE_REGEX-------------------------------------------
# --------------------------------TEST_IGNORE_MULTIPLE_REGEX-------------------------------------------
t3_configurations_path = os.path.join(CONFIGURATIONS_PATH, 'configuration_ignore_multiple_regex.yaml')
t3_cases_path = os.path.join(TEST_CASES_PATH, 'cases_ignore_multiple_regex.yaml')

Expand Down Expand Up @@ -275,8 +275,8 @@ def test_ignore_regex_type_values(configuration, metadata, new_file_path, create
@pytest.mark.parametrize('new_file_path,', [test_file], ids=[''])
@pytest.mark.parametrize('configuration, metadata', zip(t3_configurations, t3_configuration_metadata), ids=t3_case_ids)
def test_ignore_multiple_regex(configuration, metadata, new_file_path, create_file, truncate_monitored_files,
set_wazuh_configuration, configure_local_internal_options_function,
restart_wazuh_function):
set_wazuh_configuration, configure_local_internal_options_function,
restart_wazuh_function):
'''
description: Check if logcollector behavior when two ignore tags are added.
Expand Down Expand Up @@ -347,10 +347,10 @@ def test_ignore_multiple_regex(configuration, metadata, new_file_path, create_fi

# Check response
if 'regex1' in metadata['matches']:
evm.check_ignore_restrict_messages(message=log, regex=metadata['regex1'], tag='ignore',prefix=prefix)
evm.check_ignore_restrict_messages(message=log, regex=metadata['regex1'], tag='ignore', prefix=prefix)
evm.check_ignore_restrict_message_not_found(message=log, regex=metadata['regex2'], tag='ignore', prefix=prefix)
elif metadata['matches'] == 'regex2':
evm.check_ignore_restrict_messages(message=log, regex=metadata['regex2'], tag='ignore',prefix=prefix)
evm.check_ignore_restrict_messages(message=log, regex=metadata['regex2'], tag='ignore', prefix=prefix)
evm.check_ignore_restrict_message_not_found(message=log, regex=metadata['regex1'], tag='ignore', prefix=prefix)
else:
evm.check_ignore_restrict_message_not_found(message=log, regex=metadata['regex1'], tag='ignore', prefix=prefix)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
# Test configurations and cases data
test_file = os.path.join(PREFIX, 'test')

#---------------------------------TEST_DEFAULT_REGEX--------------------------------------------------
# --------------------------------TEST_DEFAULT_REGEX--------------------------------------------------
t1_configurations_path = os.path.join(CONFIGURATIONS_PATH, 'configuration_restrict_regex_default.yaml')
t1_cases_path = os.path.join(TEST_CASES_PATH, 'cases_restrict_regex_default.yaml')

Expand All @@ -82,7 +82,7 @@
t1_configurations = load_configuration_template(t1_configurations_path, t1_configuration_parameters,
t1_configuration_metadata)

#---------------------------------TEST_IGNORE_REGEX_TYPE_VALUES--------------------------------------
# --------------------------------TEST_IGNORE_REGEX_TYPE_VALUES--------------------------------------
t2_configurations_path = os.path.join(CONFIGURATIONS_PATH, 'configuration_restrict_regex_type_values.yaml')
t2_cases_path = os.path.join(TEST_CASES_PATH, 'cases_restrict_regex_type_values.yaml')

Expand All @@ -93,7 +93,7 @@
t2_configuration_metadata)


#---------------------------------TEST_RESTRICT_MULTIPLE_REGEX-------------------------------------------
# --------------------------------TEST_RESTRICT_MULTIPLE_REGEX-------------------------------------------
t3_configurations_path = os.path.join(CONFIGURATIONS_PATH, 'configuration_restrict_multiple_regex.yaml')
t3_cases_path = os.path.join(TEST_CASES_PATH, 'cases_restrict_multiple_regex.yaml')

Expand Down Expand Up @@ -276,8 +276,8 @@ def test_restrict_regex_type_values(configuration, metadata, new_file_path, crea
@pytest.mark.parametrize('new_file_path,', [test_file], ids=[''])
@pytest.mark.parametrize('configuration, metadata', zip(t3_configurations, t3_configuration_metadata), ids=t3_case_ids)
def test_restrict_multiple_regex(configuration, metadata, new_file_path, create_file, truncate_monitored_files,
set_wazuh_configuration, configure_local_internal_options_function,
restart_wazuh_function):
set_wazuh_configuration, configure_local_internal_options_function,
restart_wazuh_function):
'''
description: Check if logcollector behavior when two restrict tags are added.
Expand Down Expand Up @@ -349,14 +349,15 @@ def test_restrict_multiple_regex(configuration, metadata, new_file_path, create_
# Check response
if 'regex1' in metadata['matches']:
evm.check_ignore_restrict_message_not_found(message=log, regex=metadata['regex1'], tag='restrict',
prefix=prefix)
prefix=prefix)
if 'regex2' in metadata['matches']:
evm.check_ignore_restrict_message_not_found(message=log, regex=metadata['regex2'], tag='restrict',
prefix=prefix)
else:
evm.check_ignore_restrict_messages(message=log, regex=metadata['regex2'], tag='restrict',prefix=prefix)
evm.check_ignore_restrict_messages(message=log, regex=metadata['regex2'], tag='restrict', prefix=prefix)
elif metadata['matches'] == 'regex2':
evm.check_ignore_restrict_message_not_found(message=log, regex=metadata['regex2'], tag='restrict', prefix=prefix)
evm.check_ignore_restrict_messages(message=log, regex=metadata['regex1'], tag='restrict',prefix=prefix)
evm.check_ignore_restrict_message_not_found(message=log, regex=metadata['regex2'], tag='restrict',
prefix=prefix)
evm.check_ignore_restrict_messages(message=log, regex=metadata['regex1'], tag='restrict', prefix=prefix)
else:
evm.check_ignore_restrict_messages(message=log, regex=metadata['regex1'], tag='restrict',prefix=prefix)
evm.check_ignore_restrict_messages(message=log, regex=metadata['regex1'], tag='restrict', prefix=prefix)

0 comments on commit 71219c7

Please sign in to comment.