-
Notifications
You must be signed in to change notification settings - Fork 32
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
Remove workarround restart manager logtest #1507
Remove workarround restart manager logtest #1507
Conversation
937631c
to
29dd8d3
Compare
Testtest_invalid_decoder_syntax.py
test_invalid_rules_syntax.py
test_remove_old_sessions.py
test_remove_old_session_for_inactivity.py
|
164fb53
to
e9d2e23
Compare
LGTM!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
LGTM ! |
.../integration/test_logtest/test_remove_old_sessions/test_remove_old_session_for_inactivity.py
Outdated
Show resolved
Hide resolved
tests/integration/test_logtest/test_remove_old_sessions/test_remove_old_sessions.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GJ, but some changes are required.
.../integration/test_logtest/test_remove_old_sessions/test_remove_old_session_for_inactivity.py
Outdated
Show resolved
Hide resolved
@pytest.fixture(scope='module') | ||
def get_local_internal_options(): | ||
"""Get configurations from the module.""" | ||
return local_internal_options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use configure_local_internal_options_module
fixture, instead. Otherwise , local_internal_options
dictionary will be useless. You should rebase this branch to add that fixture.
@pytest.fixture(scope='module') | |
def get_local_internal_options(): | |
"""Get configurations from the module.""" | |
return local_internal_options |
def test_remove_old_session_for_inactivity(get_local_internal_options, | ||
configure_local_internal_options, | ||
get_configuration, | ||
configure_environment, | ||
restart_required_logtest_daemons, | ||
wait_for_logtest_startup, | ||
connect_to_sockets_function): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def test_remove_old_session_for_inactivity(get_local_internal_options, | |
configure_local_internal_options, | |
get_configuration, | |
configure_environment, | |
restart_required_logtest_daemons, | |
wait_for_logtest_startup, | |
connect_to_sockets_function): | |
def test_remove_old_session_for_inactivity(configure_local_internal_options, | |
get_configuration, | |
configure_environment, | |
restart_required_logtest_daemons, | |
wait_for_logtest_startup, | |
connect_to_sockets_function): |
@pytest.fixture(scope='module') | ||
def wait_for_logtest_startup(request): | ||
"""Wait until logtest has begun.""" | ||
log_monitor = FileMonitor(LOG_FILE_PATH) | ||
log_monitor.start(timeout=logtest_startup_timeout, callback=callback_logtest_started) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is used for other logtest tests. Create a contest file for the logtest folder and adds this fixture, in order to avoid code repetition.
@pytest.fixture(scope='module') | ||
def get_local_internal_options(): | ||
"""Get configurations from the module.""" | ||
return local_internal_options | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as before
wazuh_log_monitor = FileMonitor(LOG_FILE_PATH) | ||
logtest_sock = os.path.join(os.path.join(WAZUH_PATH, 'queue', 'sockets', 'logtest')) | ||
|
||
local_internal_options = {'analysisd.debug': str(1)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local_internal_options = {'analysisd.debug': str(1)} | |
local_internal_options = {'analysisd.debug': '1'} |
msg_create_session = """{"version":1, "command":"log_processing", "parameters":{ | ||
"event": "Oct 15 21:07:56 linux-agent sshd[29205]: Invalid user blimey from 18.18.18.18 port 48928", | ||
"log_format": "syslog", "location": "master->/var/log/syslog"}}""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use json.dump
instead
msg_create_session = """{"version":1, "command":"log_processing", "parameters":{ | |
"event": "Oct 15 21:07:56 linux-agent sshd[29205]: Invalid user blimey from 18.18.18.18 port 48928", | |
"log_format": "syslog", "location": "master->/var/log/syslog"}}""" | |
create_session_data = {'version': 1, 'command': 'log_processing', 'parameters': {'event': 'Oct 15 21:07:56 linux-agent sshd[29205]: Invalid user blimey from 18.18.18.18 port 48928', 'log_format': 'syslog', 'location': 'master->/var/log/syslog'}} | |
msg_create_session = json.dumps(create_session_data) | |
@@ -22,17 +24,23 @@ | |||
configurations = load_wazuh_configurations(configurations_path, __name__) | |||
|
|||
# Variables | |||
logtest_startup_timeout = 30 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe 30 seconds is too much to wait for logtest. Maybe is better to set it to '3'.
Other minor considerations about this PR:
Also |
4e523d0
to
fb0b3af
Compare
The base branch was changed.
8b49c37
to
408f58e
Compare
ae5d1bb
to
b60930d
Compare
Package
TestingLogtest
|
e2c6429
to
22142dd
Compare
6c877bd
to
966476a
Compare
6c877bd
to
22142dd
Compare
…orkarround-restart-manager-logtest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Hi team!,
This PR implements 3 changes:
Regards,
Julian
Tests
pycodestyle --max-line-length=120 --show-source --show-pep8 file.py
.provision_documentation.sh
generate the docs without errors.