Skip to content

Commit

Permalink
refac: Some variables extracted from the QA framework. #1850
Browse files Browse the repository at this point in the history
  • Loading branch information
mauromalara committed Sep 26, 2022
1 parent e2da59b commit 63ea8d7
Showing 1 changed file with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
import pytest
import subprocess

from wazuh_testing.tools import WAZUH_PATH
from wazuh_testing.tools import WAZUH_PATH, ANALYSISD_QUEUE_SOCKET_PATH, ANALYSISD_DAEMON
from wazuh_testing.tools.services import control_service, check_daemon_status

# Marks
Expand All @@ -63,8 +63,7 @@

# Variables

ANALYSISD_SOCKET = os.path.join(WAZUH_PATH, 'queue', 'sockets', 'queue')
analysisd_path = os.path.join(WAZUH_PATH, 'bin', 'wazuh-analysisd')
analysisd_path = os.path.join(WAZUH_PATH, 'bin', ANALYSISD_DAEMON)
command_exec = f'{analysisd_path} -t'

# Fixtures
Expand All @@ -73,7 +72,7 @@
@pytest.fixture(scope="function")
def socket_file_properties():
"""Get the inode and modification time values of the 'queue' socket of 'wazuh-analysisd'"""
return os.stat(ANALYSISD_SOCKET).st_ino, os.path.getmtime(ANALYSISD_SOCKET)
return os.stat(ANALYSISD_QUEUE_SOCKET_PATH).st_ino, os.path.getmtime(ANALYSISD_QUEUE_SOCKET_PATH)


@pytest.fixture(scope="function")
Expand Down Expand Up @@ -114,8 +113,8 @@ def test_queue_socket_properties(socket_file_properties, run_analysisd_test_conf
to run the daemon configuration test of 'wazuh-analysisd'.
expected_output:
- f"The inode value for the socket {ANALYSISD_SOCKET} has changed"
- f"The modification time property for the socket {ANALYSISD_SOCKET} has changed"
- f"The inode value for the socket {ANALYSISD_QUEUE_SOCKET_PATH} has changed"
- f"The modification time property for the socket {ANALYSISD_QUEUE_SOCKET_PATH} has changed"
tags:
- errors
'''
Expand All @@ -126,8 +125,8 @@ def test_queue_socket_properties(socket_file_properties, run_analysisd_test_conf

run_analysisd_test_config

assert current_inode_file == os.stat(ANALYSISD_SOCKET).st_ino, \
f"The inode value for the socket {ANALYSISD_SOCKET} has changed"
assert current_inode_file == os.stat(ANALYSISD_QUEUE_SOCKET_PATH).st_ino, \
f"The inode value for the socket {ANALYSISD_QUEUE_SOCKET_PATH} has changed"

assert current_status_time == os.path.getmtime(ANALYSISD_SOCKET), \
f"The modification time property value for the socket {ANALYSISD_SOCKET} has changed"
assert current_status_time == os.path.getmtime(ANALYSISD_QUEUE_SOCKET_PATH), \
f"The modification time property value for the socket {ANALYSISD_QUEUE_SOCKET_PATH} has changed"

0 comments on commit 63ea8d7

Please sign in to comment.