-
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.
refactor(#2947): Move analysisd fixtures to integration conftest
- Loading branch information
Showing
4 changed files
with
40 additions
and
53 deletions.
There are no files selected for viewing
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
File renamed without changes.
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 |
---|---|---|
@@ -1,36 +1,13 @@ | ||
# 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 | ||
import os | ||
import pytest | ||
|
||
from wazuh_testing.tools.services import control_service | ||
from wazuh_testing.tools import configuration | ||
from wazuh_testing.tools.run_simulator import simulate_agent,syslog_simulator | ||
|
||
|
||
@pytest.fixture(scope='function') | ||
def set_wazuh_configuration_analysisd(configuration, set_wazuh_configuration, configure_local_internal_options_eps): | ||
"""Set wazuh configuration | ||
Args: | ||
configuration (dict): Configuration template data to write in the ossec.conf. | ||
set_wazuh_configuration (fixture): Set the wazuh configuration according to the configuration data. | ||
configure_local_internal_options_eps (fixture): Set the local_internal_options.conf file. | ||
""" | ||
yield | ||
|
||
|
||
@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='function') | ||
def configure_wazuh_one_thread(): | ||
def configure_analysisd_one_thread(): | ||
"""Fixture to configure the local internal options file to work with one thread.""" | ||
local_internal_options = {'analysisd.event_threads': '1', 'analysisd.syscheck_threads': '1', | ||
'analysisd.syscollector_threads': '1', 'analysisd.rootcheck_threads': '1', | ||
|
@@ -48,30 +25,3 @@ def configure_wazuh_one_thread(): | |
|
||
# Backup the old local internal options cofiguration | ||
configuration.set_wazuh_local_internal_options(backup_local_internal_options) | ||
|
||
|
||
@pytest.fixture(scope='session') | ||
def load_wazuh_basic_configuration(): | ||
"""Load a new basic configuration to the manager""" | ||
# Reference paths | ||
DATA_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'data') | ||
CONFIGURATIONS_PATH = os.path.join(DATA_PATH, 'wazuh_basic_configuration') | ||
configurations_path = os.path.join(CONFIGURATIONS_PATH, 'ossec.conf') | ||
|
||
backup_ossec_configuration = configuration.get_wazuh_conf() | ||
|
||
with open(configurations_path, 'r') as file: | ||
lines = file.readlines() | ||
configuration.write_wazuh_conf(lines) | ||
|
||
yield | ||
|
||
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 |
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