-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add: Add new test_queue_socket_status first approach #1850
- Loading branch information
1 parent
db6bc04
commit b4ab243
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
tests/integration/test_analysisd/test_queue_socket_status/test_queue_socket_status.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import os | ||
import pytest | ||
import subprocess | ||
|
||
from wazuh_testing.tools import WAZUH_PATH | ||
|
||
|
||
# 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' | ||
|
||
|
||
|
||
def test_queue_socket_status(): | ||
current_inode_file = os.stat(ANALYSISD_SOCKET).st_ino | ||
current_status_time = os.path.getmtime(ANALYSISD_SOCKET) | ||
|
||
# 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') |