Skip to content

Commit

Permalink
feat(#3341): Detect found and skipped logs
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-stefani committed Jan 16, 2023
1 parent 384d9e5 commit 397b19e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions deps/wazuh_testing/wazuh_testing/modules/aws/event_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ def callback_detect_event_processed(line):
return line


def callback_detect_event_processed_or_skipped(pattern):
pattern_regex = re.compile(pattern)
return lambda line: pattern_regex.match(line) or callback_detect_event_processed(line)


def callback_event_sent_to_analysisd(line):
if line.startswith(AWS_EVENT_HEADER):
return line
Expand Down
13 changes: 8 additions & 5 deletions tests/integration/test_aws/test_discard_regex.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

import pytest
from wazuh_testing import global_parameters
from wazuh_testing import global_parameters, T_20
from wazuh_testing.modules.aws import event_monitor
from wazuh_testing.modules.aws.db_utils import s3_db_exists
from wazuh_testing.tools.configuration import (
Expand Down Expand Up @@ -128,10 +128,13 @@ def test_discard_regex(
).result()

wazuh_log_monitor.start(
timeout=10,
callback=event_monitor.make_aws_callback(pattern),
error_message='The AWS module did not show correct message about discard regex',
accum_results=skipped_logs
timeout=T_20,
callback=event_monitor.callback_detect_event_processed_or_skipped(pattern),
error_message=(
'The AWS module did not show correct message about discard regex or ',
'did not process the expected amout of logs'
),
accum_results=found_logs + skipped_logs
).result()

assert s3_db_exists()

0 comments on commit 397b19e

Please sign in to comment.