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

Fixed IT control_service Windows loop #4765

Merged
merged 1 commit into from
Dec 14, 2023
Merged

Conversation

rauldpm
Copy link
Member

@rauldpm rauldpm commented Dec 12, 2023

Related issue
Closes #4758

Description

This pull request corrects a condition that did not include the successful return code, causing multiple executions of the net command in Windows and causing the integration test to fail on certain occasions.

Updated

  • Fixed conditional to avoid unnecessary loops and run the same command multiple times

Testing performed

Tester Test path Jenkins Local OS Commit Notes
@raulpm (Developer) test_active_response/ 🟢 🟢 Windows 2016 ba3e41e Nothing to highlight
@user (Reviewer) ⚫⚫⚫ 🚫 🚫 🚫 Nothing to highlight
Local test
PS C:\tmp\Test_integration_B45414_20231212181558\tests\integration> pytest .\test_active_response\ -sv
====================================================== test session starts =======================================================
platform win32 -- Python 3.11.4, pytest-7.1.2, pluggy-1.3.0 -- C:\Python311\python.exe
cachedir: .pytest_cache
metadata: {'Python': '3.11.4', 'Platform': 'Windows-10-10.0.14393-SP0', 'Packages': {'pytest': '7.1.2', 'pluggy': '1.3.0'}, 'Plugi
s': {'html': '3.1.1', 'metadata': '3.0.0', 'testinfra': '5.0.0'}}
rootdir: C:\tmp\Test_integration_B45414_20231212181558\tests\integration, configfile: pytest.ini
plugins: html-3.1.1, metadata-3.0.0, testinfra-5.0.0
collected 14 items / 12 deselected / 2 selected

test_active_response/test_execd/test_execd_restart.py::test_execd_restart[get_configuration0] stop

The Wazuh service was stopped successfully.


Result

0

Iteraction

0
2023/12/12 17:43:33 agent-auth: INFO: Started (pid: 6404).
2023/12/12 17:43:33 agent-auth: INFO: Requesting a key from server: 127.0.0.1
2023/12/12 17:43:33 agent-auth: INFO: No authentication password provided
2023/12/12 17:43:33 agent-auth: INFO: Using agent name as: EC2AMAZ-NRK2S46
2023/12/12 17:43:33 agent-auth: INFO: Waiting for server reply
2023/12/12 17:43:33 agent-auth: INFO: Valid key received
start
The Wazuh service is starting.
The Wazuh service was started successfully.


Result

0

Iteraction

0
PASSED
test_active_response/test_execd/test_execd_restart.py::test_execd_restart[get_configuration1]
Tuesday, December 12, 2023 5:43:37 PM


stop

The Wazuh service was stopped successfully.


Result

0

Iteraction

0
start
The Wazuh service is starting.
The Wazuh service was started successfully.


Result

0

Iteraction

0
stop
The Wazuh service is stopping.
The Wazuh service was stopped successfully.


Result

0

Iteraction

0
2023/12/12 17:43:45 agent-auth: INFO: Started (pid: 5004).
2023/12/12 17:43:45 agent-auth: INFO: Requesting a key from server: 127.0.0.1
2023/12/12 17:43:45 agent-auth: INFO: No authentication password provided
2023/12/12 17:43:45 agent-auth: INFO: Using agent name as: EC2AMAZ-NRK2S46
2023/12/12 17:43:45 agent-auth: INFO: Waiting for server reply
2023/12/12 17:43:45 agent-auth: INFO: Valid key received
start
The Wazuh service is starting.
The Wazuh service was started successfully.


Result

0

Iteraction

0
PASSED
Tuesday, December 12, 2023 5:43:50 PM


stop

The Wazuh service was stopped successfully.


Result

0

Iteraction

0
start
The Wazuh service is starting.
The Wazuh service was started successfully.


Result

0

Iteraction

0


======================================================== warnings summary ========================================================
test_active_response/test_execd/test_execd_restart.py::test_execd_restart[get_configuration0]
test_active_response/test_execd/test_execd_restart.py::test_execd_restart[get_configuration1]
  C:\Python311\Lib\site-packages\wazuh_testing\tools\remoted_sim.py:108: DeprecationWarning: setName() is deprecated, set the name
attribute instead
    self.listener_thread.setName('listener_thread')

test_active_response/test_execd/test_execd_restart.py::test_execd_restart[get_configuration0]
test_active_response/test_execd/test_execd_restart.py::test_execd_restart[get_configuration1]
  C:\Python311\Lib\site-packages\wazuh_testing\tools\monitoring.py:594: DeprecationWarning: ssl.wrap_socket() is deprecated, use S
LContext.wrap_socket()
    connstream = ssl.wrap_socket(newsocket,

test_active_response/test_execd/test_execd_restart.py::test_execd_restart[get_configuration0]
test_active_response/test_execd/test_execd_restart.py::test_execd_restart[get_configuration1]
  C:\Python311\Lib\ssl.py:1438: DeprecationWarning: ssl.PROTOCOL_TLSv1_2 is deprecated
    context = SSLContext(ssl_version)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================= 2 passed, 12 deselected, 6 warnings in 21.12s ==========================================

@rauldpm rauldpm self-assigned this Dec 12, 2023
@rauldpm rauldpm marked this pull request as draft December 12, 2023 16:48
@rauldpm rauldpm linked an issue Dec 12, 2023 that may be closed by this pull request
@rauldpm rauldpm marked this pull request as ready for review December 12, 2023 17:45
@rauldpm rauldpm changed the title fix: added successful result condition Fixed IT control_service Windows loop Dec 12, 2023
Copy link
Member

@Rebits Rebits left a comment

Choose a reason for hiding this comment

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

LGTM

@davidjiglesias davidjiglesias merged commit af7944b into 4.8.0 Dec 14, 2023
5 checks passed
@davidjiglesias davidjiglesias deleted the bug/4758-ar-windows branch December 14, 2023 06:48
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 this pull request may close these issues.

Windows agent failed to restart in AR tests
3 participants