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

Fix 'test_remoted/test_agent_communication/test_request_agent_info' tests in 4.2 #1579

Closed
4 tasks
Tracked by #1530
damarisg opened this issue Jul 6, 2021 · 3 comments
Closed
4 tasks
Tracked by #1530
Assignees

Comments

@damarisg
Copy link
Member

damarisg commented Jul 6, 2021

Issue information

Related issue
Closes #1530

When it comes to starting with the test fix, there is some information that can help you:

Module: Remoted
Support Team: "Core" 
Channel: "devel-core"
Target: Manager   
OS: Linux

I add some information obtained while researched the logs that failed.

Case:

Type Description
Test Path test_remoted/test_agent_communication/test_request_agent_info
Consistent no
Test Execution 2/3 executions failed
Cases Fails 2
Summary On test_request when it called to send_request. It should to do research with more details because in the logs doesn't show any details.

In order to finish this issue the following tasks should be fulfilled:

  • Research of fails.
  • Apply Fix
  • Full Green/ Full Yellow in test_remoted/test_agent_communication/test_request_agent_info for 3 times.
  • Documentation of any important change done for these tests or the used tools.
@mdengra
Copy link
Contributor

mdengra commented Jul 20, 2021

2021-07-20

Used Wazuh-QA branch: 1516-4.2.0-full-green
Test results with the modules sca, syscollector and rootcheck modules disabled in the ossec.conf:

Test Executions Date By Status
test_request_agent_info_local_r1.log 2021-07-20 Miguel 🔴
test_request_agent_info_local_r2.log 2021-07-20 Miguel 🔴
test_request_agent_info_local_r3.log 2021-07-20 Miguel 🔴

The test still fails with the previously mentioned modules disabled, so in principle, we can discard that the failures are due to FileMonitor.

It is worth noting that the test fails on the same use cases during all runs:

FAILED test_remoted/test_agent_communication/test_request_agent_info.py::test_request[udp,tcp-disconnected]
FAILED test_remoted/test_agent_communication/test_request_agent_info.py::test_request[tcp-disconnected]
FAILED test_remoted/test_agent_communication/test_request_agent_info.py::test_request[udp-disconnected]

@mdengra
Copy link
Contributor

mdengra commented Jul 21, 2021

2021-07-20

After some research, it seems that in the use cases where the errors occur the remoted socket is not ready when the request is sent, so no response is received and therefore the test fails. The solution for this problem may be to add a small sleep for those use cases.

I also think that the use cases can be reduced from the current 9 to 3, as these are repeating during the test:

parameters = [
    {'PROTOCOL': 'udp,tcp'},
    {'PROTOCOL': 'tcp'},
    {'PROTOCOL': 'udp'},
]
test_case = {
    'disconnected': ('agent getconfig disconnected',
                     'Cannot send request'),
    'get_config': ('agent getconfig client',
                   '{"client":{"config-profile":"centos8","notify_time":10,"time-reconnect":60}}'),
    'get_state': ('logcollector getstate',
                  '{"error":0,"data":{"global":{"start":"2021-02-26, 06:41:26","end":"2021-02-26 08:49:19"}}}')
}

In the code shown, each parameter is combined with a use case, but the first parameter already includes the other two, testing both protocols inside a for loop within the main test code. Therefore setting the parameters as:

parameters = [
    {'PROTOCOL': 'udp,tcp'},
]

The three test_case are combined with the two communication protocols.

mdengra added a commit that referenced this issue Jul 21, 2021
refac: Delete six redundant use cases

Closes: #1579
@damarisg
Copy link
Member Author

After merging #1624, it works successfully.

Test Executions Date By Status
YellowResultsRequestAgentInfo.log 2021-07-26 Seyla 🟢
YellowResultsRequestAgentInfo2.log 2021-07-26 Seyla 🟢
YellowResultsRequestAgentInfo3.log 2021-07-26 Seyla 🟢

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

No branches or pull requests

2 participants