Skip to content

Commit

Permalink
doc: Documented test_queue_socket_properties #1850
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernando authored and mauromalara committed Sep 26, 2022
1 parent 5734032 commit c209534
Showing 1 changed file with 86 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,3 +1,56 @@
'''
copyright: Copyright (C) 2015-2021, Wazuh Inc.
Created by Wazuh, Inc. <[email protected]>.
This program is free software; you can redistribute it and/or modify it under the terms of GPLv2
type: integration
brief: The 'wazuh-analysisd' daemon refreshes the queue socket file every time the daemon is set to
the testing configuration.
Specifically, this test will check if after setting up the 'wazuh-analysisd' daemon to the
testing configuration the Inode and Filetime properties of the queue socket are changed.
tier: 0
modules:
- analysisd
components:
- manager
daemons:
- wazuh-analysisd
os_platform:
- linux
os_version:
- Arch Linux
- Amazon Linux 2
- Amazon Linux 1
- CentOS 8
- CentOS 7
- CentOS 6
- Ubuntu Focal
- Ubuntu Bionic
- Ubuntu Xenial
- Ubuntu Trusty
- Debian Buster
- Debian Stretch
- Debian Jessie
- Debian Wheezy
- Red Hat 8
- Red Hat 7
- Red Hat 6
references:
- https://documentation.wazuh.com/current/user-manual/reference/daemons/wazuh-analysisd.html
tags:
- analysisd
'''
import os
import pytest
import subprocess
Expand All @@ -19,10 +72,12 @@

@pytest.fixture(scope="function")
def socket_file_properties():
"""Get the Inode and File time value of the 'queue' socket of 'wazuh-analysisd'"""
return os.stat(ANALYSISD_SOCKET).st_ino, os.path.getmtime(ANALYSISD_SOCKET)

@pytest.fixture(scope="function")
def run_analysisd_test_config():
"""Run the test configuration mode for the 'wazuh-analysisd' daemon"""
# restart analysisd daemon
control_service('restart', daemon='wazuh-analysisd')
check_daemon_status(running_condition=True, target_daemon='wazuh-analysisd')
Expand All @@ -33,6 +88,36 @@ def run_analysisd_test_config():


def test_queue_socket_properties(socket_file_properties, run_analysisd_test_config):
'''
description: Check if when the 'wazuh-analysisd' daemon is set up to the testing configuration, the Inode value
and the File time value of the 'queue' socket are modified.
wazuh_min_version: 4.2.0
parameters:
- socket_file_properties:
type: fixture
brief: Obtain the current properties of the 'queue' socket.
- run_analysisd_test_config:
type: fixture
brief: Change the wazuh-analysisd daemon configuration into the testing configuration mode.
assertions:
- Verify that the Inode value of the socket file does not change its value after analysisd gets the
testing configuration set up.
- Verify that the File time value of the socket file does not change its value after analysisd
gets the testing configuration set up.
input_description: The test gets the current properties of the socket file and some configutation parameters
to configure the 'wazuh-analysisd' daemon.
expected_output:
- f"The Inode value for the socket {ANALYSISD_SOCKET} has changed"
- f"The Filetime value for the socket {ANALYSISD_SOCKET} has changed"
tags:
- errors
'''
# Check if analysisd daemon is running
check_daemon_status(running_condition=True, target_daemon='wazuh-analysisd')

Expand All @@ -44,4 +129,4 @@ def test_queue_socket_properties(socket_file_properties, run_analysisd_test_conf
f"The Inode 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"
f"The File time value for the socket {ANALYSISD_SOCKET} has changed"

0 comments on commit c209534

Please sign in to comment.