Skip to content

Commit

Permalink
refactor(#2947): remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
jmv74211 committed Sep 29, 2022
1 parent 4528aeb commit 3a58a40
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 83 deletions.
1 change: 0 additions & 1 deletion deps/wazuh_testing/wazuh_testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
API_DAEMONS_REQUIREMENTS = [API_DAEMON, DB_DAEMON, EXEC_DAEMON, ANALYSISD_DAEMON, REMOTE_DAEMON, MODULES_DAEMON]

# Paths
SIMULATE_AGENT = os.path.join(WAZUH_TESTING_PATH, 'scripts', 'simulate_agents.py')
SYSLOG_SIMULATOR = os.path.join(WAZUH_TESTING_PATH, 'scripts', 'syslog_simulator.py')
ANALYSISD_STATE = os.path.join(WAZUH_PATH, 'var', 'run', 'wazuh-analysisd.state')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

ANALYSISD_PREFIX = r'.*wazuh-analysisd.*'
MAILD_PREFIX = r'.*wazuh-maild.*'

QUEUE_EVENTS_SIZE = 16384
ANALYSISD_ONE_THREAD_CONFIG = {'analysisd.event_threads': '1', 'analysisd.syscheck_threads': '1',
'analysisd.syscollector_threads': '1', 'analysisd.rootcheck_threads': '1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,3 @@ def get_analysisd_state():
analysisd_state = dict((a.strip(), b.strip()) for a, b in (element.split('=') for element in data.split('\n')))

return analysisd_state


def get_messages_info(file_monitor, message, accum_results):
"""Check if the alerts.json file contains the message
Args:
file_monitor (FileMonitor): Wazuh log monitor
message (str): Message to find
accum_results (int): Total message to accumulate
Returns:
list: List with messages information
"""
error_message = f"Could not find this event in {message}"

result = file_monitor.start(timeout=T_20, update_position=True, accum_results=accum_results,
callback=generate_monitoring_callback_groups(message),
error_message=error_message).result()

return result
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ def main():
parameters = get_parameters()
set_logging(parameters.debug)
validate_parameters(parameters)

send_messages(parameters.message, parameters.messages_number, parameters.eps, parameters.numbered_messages,
parameters.address, parameters.port, parameters.protocol)

Expand Down
24 changes: 0 additions & 24 deletions deps/wazuh_testing/wazuh_testing/tools/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,30 +763,6 @@ def get_configuration(data_file_path):
return configuration_parameters


def get_simulate_agent_configuration(data_file_path):
"""Load simulate agent configuration file.
Args:
data_file_path (str): Configuration file path.
Returns:
dict: Configurations names.
"""
return get_configuration(data_file_path)


def get_syslog_simulator_configuration(data_file_path):
"""Load syslog simulator configuration file.
Args:
data_file_path (str): Configuration file path.
Returns:
dict: Configurations names.
"""
return get_configuration(data_file_path)


def get_wazuh_local_rules():
"""
Get current `local_rules.xml` file content.
Expand Down
21 changes: 1 addition & 20 deletions deps/wazuh_testing/wazuh_testing/tools/run_simulator.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,7 @@
import socket
import subprocess
import sys

from wazuh_testing import SIMULATE_AGENT, SYSLOG_SIMULATOR


def simulate_agent(param):
"""Function to run the script simulate_agent.py
Args:
param (dict): Dictionary with script parameters
"""
# Get IP address of the host
hostname = socket.gethostname()
ip_addr = socket.gethostbyname(hostname)

python_executable = sys.executable
subprocess.call(f"{python_executable} {SIMULATE_AGENT} -a {ip_addr} -n {param['num_agent']} \
-m {param['modules']} -s {param['eps']} -t {param['time']} \
-f {param['msg_size']} -e {param['num_messages']} \
-k {param['disable_keepalive_msg']} -d {param['disable_receive_msg']} \
-c {param['enable_logcollector_msg_number']} -g {param['message']}", shell=True)
from wazuh_testing import SYSLOG_SIMULATOR


def syslog_simulator(parameters):
Expand Down
16 changes: 0 additions & 16 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1202,14 +1202,6 @@ def create_file(new_file_path):
remove_file(new_file_path)


@pytest.fixture(scope='function')
def simulate_agent_function(request):
"""Fixture to run the script simulate_agent.py"""
simulate_agent(request.param)

yield


@pytest.fixture(scope='session')
def load_wazuh_basic_configuration():
"""Load a new basic configuration to the manager"""
Expand All @@ -1228,14 +1220,6 @@ def load_wazuh_basic_configuration():
write_wazuh_conf(backup_ossec_configuration)


@pytest.fixture(scope='function')
def syslog_simulator_function(request):
"""Fixture to run the script syslog_simulator.py"""
syslog_simulator(request.param)

yield


@pytest.fixture(scope='function')
def truncate_event_logs():
"""Truncate all the event log files"""
Expand Down

0 comments on commit 3a58a40

Please sign in to comment.