Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wazuh log monitor handler fixture #1832

Closed
Rebits opened this issue Sep 2, 2021 · 0 comments · Fixed by #1833
Closed

Wazuh log monitor handler fixture #1832

Rebits opened this issue Sep 2, 2021 · 0 comments · Fixed by #1833
Assignees

Comments

@Rebits
Copy link
Member

Rebits commented Sep 2, 2021

Description

Currently, the logic related to the creation and truncation of the ossec.log is placed inside the restart daemons fixtures. For example

@pytest.fixture(scope='module')
def restart_logcollector(get_configuration, request):
    """Reset log file and start a new monitor."""
    control_service('stop', daemon=DAEMON_NAME)
    truncate_file(LOG_FILE_PATH)
    file_monitor = FileMonitor(LOG_FILE_PATH)
    setattr(request.module, 'wazuh_log_monitor', file_monitor)
    control_service('start', daemon=DAEMON_NAME)

This is problematic due to the following reasons:

  • Every fixture should be as encapsulated as possible.
  • It required the get_configuration fixture to work. The ossec.log file should be truncated after tests finish.

For these reasons, It should convenient to create a unique fixture for this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant