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

Add an IT to check that the agent erases its wazuh-agent.state file #4716

Merged
merged 2 commits into from
Feb 27, 2024

Conversation

vikman90
Copy link
Member

@vikman90 vikman90 commented Nov 24, 2023

Related issue Related PR
wazuh/wazuh#16253 wazuh/wazuh#20425

Description

The agent holds a file called wazuh-agent.state containing data related to the connection. We expect this file to disappear at the agent's stop.

This PR aims to fix this behavior in the Windows agent, that was not deleting the file properly.

Added

  • test_state_delete at test_agent_delete.

Testing performed

Tester Test path Jenkins Local OS Commit Notes
@vikman90 (Developer) test_agent_delete/test_state_delete 🟢 Windows 11 84a6353503 Nothing to highlight
@user (Reviewer) ⚫⚫⚫ 🚫 🚫 🚫 Nothing to highlight
Test output
================================================= test session starts =================================================
platform win32 -- Python 3.11.6, pytest-7.1.2, pluggy-1.2.0
rootdir: D:\Vikman\Desktop\wazuh-qa-4.7.1\tests\integration, configfile: pytest.ini
plugins: html-3.1.1, metadata-3.0.0, testinfra-8.1.0
collected 4 items / 3 deselected / 1 selected

test_agentd_state.py .                                                                                           [100%]

================================================== warnings summary ===================================================
C:\Users\Vikman\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\certifi\core.py:36
  C:\Users\Vikman\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\certifi\core.py:36: DeprecationWarning: path is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
    _CACERT_CTX = get_path("certifi", "cacert.pem")

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
===================================== 1 passed, 3 deselected, 1 warning in 0.81s ======================================

Copy link
Member

@rauldpm rauldpm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small change, we need to keep things documented, that parameter is a method defined in

def restart_wazuh_daemon_after_finishing(daemon=None):

tests/integration/test_agentd/test_agentd_state.py Outdated Show resolved Hide resolved
rauldpm
rauldpm previously approved these changes Feb 26, 2024
@vikman90 vikman90 changed the base branch from master to 4.9.0 February 27, 2024 09:50
@vikman90 vikman90 dismissed rauldpm’s stale review February 27, 2024 09:50

The base branch was changed.

@vikman90 vikman90 merged commit c982508 into 4.9.0 Feb 27, 2024
2 checks passed
@vikman90 vikman90 deleted the fix/16253-delete-agent-state branch February 27, 2024 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows Wazuh agent fails to update or delete wazuh-agentd.state when service stopped
2 participants