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

Full Yellow Local - Fix WazuhDB tests self-configuration in 4.2 #1643

Merged
merged 7 commits into from
Aug 17, 2021

Conversation

Rebits
Copy link
Member

@Rebits Rebits commented Jul 26, 2021

Related issue
Closes #1535

Description

After research #1493, we could see that WazuhDB tests fail in case Wazuh Manager does not start for the first time. Also, it was detected that in case of the manager has already registered some agents, independently of the state of them, these tests produce false positives. This is error is commented in the original issue. This PR has been created In order to make all wazuh-qa tests independent.

Packages details

Type Format Architecture Version Revision Tag File name
Server rpm x86_64 4.2.0 40207 v4.2.0-rc8 wazuh-manager-4.2.0-1.1493.x86_64.rpm

Local internal options

No local internal options are required.

Pytest args

No arguments are required.

Testing process

In order, to properly test, this issue is necessary to ensure:

  • There aren't false positives in a newly provisioned environment, in which the manager has not been started.
  • There aren't false positives in an environment in which the manager has already registered agents.

Tests results

New provisioned environment

In progress.

Already registered agents

In progress.

@Rebits Rebits changed the base branch from master to 1516-4.2.0-full-green July 26, 2021 08:11
@juliamagan
Copy link
Member

juliamagan commented Jul 26, 2021

I have launched wazuh_db tests in branch 1535_full-green-wazuhdb six times. The first three times, when the manager is started and has already registered agents.

Tests results

R1 R2 R3 Reports
CentOS 8 Manager 🟢 🟢 🟢 Tests results

Then, I have launched three times, when the wazuh manager was never started.

R1 R2 R3 Reports
CentOS 8 Manager 🟢 🟢 🟢 Tests results

Comment on lines 2 to 3
import subprocess
import subprocess as sb
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
import subprocess
import subprocess as sb
import subprocess as sb

It is imported twice, we can delete one import if it is not necessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done d2419f5



def list_agents_ids():
wazuhdb_result = query_wdb("global get-all-agents last_id -1")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
wazuhdb_result = query_wdb("global get-all-agents last_id -1")
wazuhdb_result = query_wdb('global get-all-agents last_id -1')

Copy link
Member Author

Choose a reason for hiding this comment

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

Done d2419f5

Comment on lines 29 to 30
agent_ids_list = list_agents_ids()
remove_agents(agent_ids_list, remove_type)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
agent_ids_list = list_agents_ids()
remove_agents(agent_ids_list, remove_type)
remove_agents(list_agents_ids(), remove_type)

If it is possible, we could call the function list_agents_ids() inside remove_agents and the code would be simpler.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done d2419f5

@@ -56,7 +58,16 @@ def regex_match(regex, string):
return re.match(regex, string)


Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# Fixtures

Copy link
Member Author

Choose a reason for hiding this comment

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

This comment follows the file standard, however, maybe they are not very useful. It should be necessary to standardize all tests structure and commentaries with the rest of the team in the future.

Fix minnor style error in wazuh_manager module
@snaow
Copy link
Contributor

snaow commented Aug 17, 2021

Tests results

@snaow

Status Reports
manager/linux 🟡 report_wazuhdb.zip

@snaow snaow merged commit 8189810 into 1516-4.2.0-full-green Aug 17, 2021
@snaow snaow deleted the 1535_full-green-wazuhdb branch August 17, 2021 08:19
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.

Full Yellow Local - WazuhDB tests in 4.2
3 participants