wazuh / qa-system-framework

GNU General Public License v2.0
1 stars 3 forks source link

Stopping agents ungracefully feature #72

Closed pro-akim closed 1 year ago

pro-akim commented 1 year ago
Related Issue
#61

Description

This PR includes additional parameters for stop_agent and stop_agents, making possible to stop them ungracefully

Evidences

Running:

1. wh.stop_agent("agent1", type='gracefully') 2. wh.stop_agent("agent1", type='ungracefully') 3. wh.stop_agents(["agent1", "agent2"], type='gracefully', parallel=True) 4. wh.stop_agents(["agent1", "agent2"], type='ungracefully', parallel=True) 5. wh.stop_agents(["agent1", "agent2"], type='gracefully', parallel=False) 6. wh.stop_agents(["agent1", "agent2"], type='ungracefully', parallel=False)

Results:

1. agent1 stopped gracefully 2. agent1 stopped ungracefully 3. agent1 and agent2 stopped gracefully 4. agent1 and agent2 stopped ungracefully 5. agent1 and agent2 stopped gracefully one by one 6. agent1 and agent2 stopped ungracefully one by one
BelenValdivia commented 1 year ago

@pro-akim Check the failing unit tests

pro-akim commented 1 year ago

05/07/2023

Checks were done before the PR, however, it will be tested one more time when the pipeline is back. It will remain on on-hold status.

pro-akim commented 1 year ago

Evidences

Running:

1. wh.stop_agent("agent1", type='gracefully') 2. wh.stop_agent("agent1", type='ungracefully') 3. wh.stop_agents(["agent1", "agent2"], type='gracefully', parallel=True) 4. wh.stop_agents(["agent1", "agent2"], type='ungracefully', parallel=True) 5. wh.stop_agents(["agent1", "agent2"], type='gracefully', parallel=False) 6. wh.stop_agents(["agent1", "agent2"], type='ungracefully', parallel=False)

Results:

1. ``` Wazuh agent_control. List of available agents: ID: 000, Name: ip-172-31-14-219.ec2.internal (server), IP: 127.0.0.1, Active/Local ID: 001, Name: ip-172-31-4-68, IP: any, Disconnected ID: 002, Name: EC2AMAZ-2BV3AJS, IP: any, Active ``` 2. ``` Wazuh agent_control. List of available agents: ID: 000, Name: ip-172-31-14-219.ec2.internal (server), IP: 127.0.0.1, Active/Local ID: 001, Name: ip-172-31-4-68, IP: any, Disconnected ID: 002, Name: EC2AMAZ-2BV3AJS, IP: any, Active ``` 3. ``` Wazuh agent_control. List of available agents: ID: 000, Name: ip-172-31-6-43 (server), IP: 127.0.0.1, Active/Local ID: 001, Name: ip-172-31-2-206, IP: any, Disconnected ID: 002, Name: EC2AMAZ-2BV3AJS, IP: any, Disconnected ``` 4. ``` Wazuh agent_control. List of available agents: ID: 000, Name: ip-172-31-6-43 (server), IP: 127.0.0.1, Active/Local ID: 001, Name: ip-172-31-2-206, IP: any, Disconnected ID: 002, Name: EC2AMAZ-2BV3AJS, IP: any, Disconnected ``` 5. Stopped one by one ``` Wazuh agent_control. List of available agents: ID: 000, Name: ip-172-31-6-43 (server), IP: 127.0.0.1, Active/Local ID: 001, Name: ip-172-31-2-206, IP: any, Disconnected ID: 002, Name: EC2AMAZ-2BV3AJS, IP: any, Disconnected ``` 6. Stopped one by one ``` Wazuh agent_control. List of available agents: ID: 000, Name: ip-172-31-6-43 (server), IP: 127.0.0.1, Active/Local ID: 001, Name: ip-172-31-2-206, IP: any, Disconnected ID: 002, Name: EC2AMAZ-2BV3AJS, IP: any, Disconnected ```

Unit tests seem to be ok

BelenValdivia commented 1 year ago

PR checks still failing image

pro-akim commented 1 year ago

11/07/2023

Automatically triggered unit tests detect failures in code that was not modified by this issue. It will be researched.

pro-akim commented 1 year ago

11/07/2023

The status code was 403 (certificate problems). After a new run, unit tests have passed successfully.

pro-akim commented 1 year ago

Evidences

Running:

1. wh.stop_agent("agent1", gracefully=True) 2. wh.stop_agent("agent1", gracefully=False) 3. wh.stop_agents(["agent1", "agent2"], gracefully=True , parallel=True) 4. wh.stop_agents(["agent1", "agent2"], gracefully=False, parallel=True) 5. wh.stop_agents(["agent1", "agent2"], gracefully=True, parallel=False) 6. wh.stop_agents(["agent1", "agent2"], gracefully=False, parallel=False)

Results:

1. ``` Wazuh agent_control. List of available agents: ID: 000, Name: ip-172-31-0-95 (server), IP: 127.0.0.1, Active/Local ID: 001, Name: ip-172-31-6-8, IP: any, Disconnected ID: 002, Name: EC2AMAZ-2BV3AJS, IP: any, Active ``` 2. ``` Wazuh agent_control. List of available agents: ID: 000, Name: ip-172-31-0-95 (server), IP: 127.0.0.1, Active/Local ID: 001, Name: ip-172-31-6-8, IP: any, Disconnected ID: 002, Name: EC2AMAZ-2BV3AJS, IP: any, Active ``` 3. ``` Wazuh agent_control. List of available agents: ID: 000, Name: ip-172-31-0-95 (server), IP: 127.0.0.1, Active/Local ID: 001, Name: ip-172-31-6-8, IP: any, Disconnected ID: 002, Name: EC2AMAZ-2BV3AJS, IP: any, Disconnected ``` 4. ``` Wazuh agent_control. List of available agents: ID: 000, Name: ip-172-31-0-95 (server), IP: 127.0.0.1, Active/Local ID: 001, Name: ip-172-31-6-8, IP: any, Disconnected ID: 002, Name: EC2AMAZ-2BV3AJS, IP: any, Disconnected ``` 5. Stopped one by one ``` Wazuh agent_control. List of available agents: ID: 000, Name: ip-172-31-0-95 (server), IP: 127.0.0.1, Active/Local ID: 001, Name: ip-172-31-6-8, IP: any, Disconnected ID: 002, Name: EC2AMAZ-2BV3AJS, IP: any, Disconnected ``` 6. Stopped one by one ``` Wazuh agent_control. List of available agents: ID: 000, Name: ip-172-31-0-95 (server), IP: 127.0.0.1, Active/Local ID: 001, Name: ip-172-31-6-8, IP: any, Disconnected ID: 002, Name: EC2AMAZ-2BV3AJS, IP: any, Disconnected ```

Unit tests seem to be ok

pro-akim commented 1 year ago

Update

Changes done. Ready to be reviewed.

pro-akim commented 1 year ago

Update

Tested and fixed:

Evidences

Running:

1. wh.stop_agent("agent1", gracefully=True) 2. wh.stop_agent("agent1", gracefully=False) 3. wh.stop_agents(["agent1", "agent2"], gracefully=True , parallel=True) 4. wh.stop_agents(["agent1", "agent2"], gracefully=False, parallel=True) 5. wh.stop_agents(["agent1", "agent2"], gracefully=True, parallel=False) 6. wh.stop_agents(["agent1", "agent2"], gracefully=False, parallel=False)

Results:

1. ``` Wazuh agent_control. List of available agents: ID: 000, Name: ip-172-31-9-178 (server), IP: 127.0.0.1, Active/Local ID: 001, Name: ip-172-31-3-59, IP: any, Disconnected ID: 002, Name: DESKTOP-AQ2R8SM, IP: any, Active ``` 2. ``` Wazuh agent_control. List of available agents: ID: 000, Name: ip-172-31-9-178 (server), IP: 127.0.0.1, Active/Local ID: 001, Name: ip-172-31-3-59, IP: any, Disconnected ID: 002, Name: DESKTOP-AQ2R8SM, IP: any, Active ``` 3. ``` Wazuh agent_control. List of available agents: ID: 000, Name: ip-172-31-9-178 (server), IP: 127.0.0.1, Active/Local ID: 001, Name: ip-172-31-3-59, IP: any, Disconnected ID: 002, Name: DESKTOP-AQ2R8SM, IP: any, Disconnected ``` 4. ``` Wazuh agent_control. List of available agents: ID: 000, Name: ip-172-31-9-178 (server), IP: 127.0.0.1, Active/Local ID: 001, Name: ip-172-31-3-59, IP: any, Disconnected ID: 002, Name: DESKTOP-AQ2R8SM, IP: any, Disconnected ``` 5. Stopped one by one ``` Wazuh agent_control. List of available agents: ID: 000, Name: ip-172-31-9-178 (server), IP: 127.0.0.1, Active/Local ID: 001, Name: ip-172-31-3-59, IP: any, Disconnected ID: 002, Name: DESKTOP-AQ2R8SM, IP: any, Disconnected ``` 6. Stopped one by one ``` Wazuh agent_control. List of available agents: ID: 000, Name: ip-172-31-9-178 (server), IP: 127.0.0.1, Active/Local ID: 001, Name: ip-172-31-3-59, IP: any, Disconnected ID: 002, Name: DESKTOP-AQ2R8SM, IP: any, Disconnected ```

Unit tests seem to be ok