-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,43 +5,36 @@ | |
from wazuh_testing.tools import WAZUH_PATH | ||
from wazuh_testing.tools.services import control_service, check_daemon_status | ||
|
||
|
||
|
||
# Marks | ||
pytestmark = [pytest.mark.linux, pytest.mark.tier(level=0), pytest.mark.server] | ||
|
||
# variables | ||
|
||
ANALYSISD_SOCKET = os.path.join(WAZUH_PATH, 'queue', 'sockets', 'queue') | ||
analysisd_path = os.path.join(WAZUH_PATH,'bin', 'wazuh-analysisd') | ||
command_exec = f'{analysisd_path} -t' | ||
|
||
# Fixture | ||
This comment has been minimized.
Sorry, something went wrong. |
||
def configure_analysisd_queue_socket(): | ||
This comment has been minimized.
Sorry, something went wrong.
mauromalara
Contributor
|
||
# restart analysisd daemon | ||
control_service('restart', daemon='wazuh-analysisd') | ||
check_daemon_status(running_condition=True, target_daemon='wazuh-analysisd') | ||
|
||
def test_queue_socket_status(): | ||
|
||
# Updating Analysisd | ||
This comment has been minimized.
Sorry, something went wrong.
mauromalara
Contributor
|
||
run = subprocess.Popen(['/bin/bash', '-c', command_exec]) | ||
run.communicate() | ||
|
||
def test_queue_socket_properties(): | ||
# Check if analysisd daemon is running | ||
check_daemon_status(running_condition=True, target_daemon='wazuh-analysisd') | ||
if check_daemon_status(running_condition=True, target_daemon='wazuh-analysisd') is not True: | ||
This comment has been minimized.
Sorry, something went wrong.
mauromalara
Contributor
|
||
control_service('start', daemon='wazuh-analysisd') | ||
|
||
current_inode_file = os.stat(ANALYSISD_SOCKET).st_ino | ||
current_status_time = os.path.getmtime(ANALYSISD_SOCKET) | ||
|
||
# Stop analysisd daemon | ||
control_service('stop', daemon='wazuh-analysisd') | ||
check_daemon_status(running_condition=False, target_daemon='wazuh-analysisd') | ||
|
||
control_service('start', daemon='wazuh-analysisd') | ||
configure_analysisd_queue_socket() | ||
This comment has been minimized.
Sorry, something went wrong.
mauromalara
Contributor
|
||
|
||
assert current_inode_file == os.stat(ANALYSISD_SOCKET).st_ino, \ | ||
This comment has been minimized.
Sorry, something went wrong.
mauromalara
Contributor
|
||
f"The Inode value for the socket {ANALYSISD_SOCKET} has changed" | ||
|
||
# Updating Analysisd | ||
run = subprocess.Popen(['/bin/bash', '-c', command_exec]) | ||
run.communicate() | ||
|
||
try: | ||
assert current_inode_file == os.stat(ANALYSISD_SOCKET).st_ino | ||
except AssertionError: | ||
raise AssertionError(f'The Inode value for the socket {ANALYSISD_SOCKET} has changed') | ||
|
||
try: | ||
assert current_status_time == os.path.getmtime(ANALYSISD_SOCKET) | ||
except AssertionError: | ||
raise AssertionError(f'The Filetime value for the socket {ANALYSISD_SOCKET} has changed') | ||
assert current_status_time == os.path.getmtime(ANALYSISD_SOCKET), \ | ||
f"The Filetime value for the socket {ANALYSISD_SOCKET} has changed" | ||
This comment has been minimized.
Sorry, something went wrong.
mauromalara
Contributor
|
@fernandolojano This is not a fixture, because is not used like one.