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
AIT environment improvements #23204
AIT environment improvements #23204
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the modifications made to the conftest.py
and docker-compose.yml
files, every test should be run to verify the results are as expected.
Test reportsSome tests failed but after running the same build in fix/22891-ait-envBuild: https://ci.wazuh.info/job/Test_integration_endpoints/4520/
4.9.0Build: https://ci.wazuh.info/job/Test_integration_endpoints/4524/
Failed tests local executiontest_overview_endpoints.tavern.yaml(venv) gasti@gasti:~/work/wazuh/api/test/integration$ pytest -vv test_overview_endpoints.tavern.yaml --nobuild
================================================================= test session starts =================================================================
platform linux -- Python 3.10.14, pytest-7.3.1, pluggy-1.5.0 -- /home/gasti/work/wazuh/venv/bin/python
cachedir: .pytest_cache
metadata: {'Python': '3.10.14', 'Platform': 'Linux-6.1.0-20-amd64-x86_64-with-glibc2.36', 'Packages': {'pytest': '7.3.1', 'pluggy': '1.5.0'}, 'Plugins': {'asyncio': '0.18.1', 'tavern': '1.23.5', 'html': '2.1.1', 'metadata': '3.1.1', 'anyio': '4.1.0', 'trio': '0.8.0', 'aiohttp': '1.0.4'}}
rootdir: /home/gasti/work/wazuh/api/test/integration
configfile: pytest.ini
plugins: asyncio-0.18.1, tavern-1.23.5, html-2.1.1, metadata-3.1.1, anyio-4.1.0, trio-0.8.0, aiohttp-1.0.4
asyncio: mode=auto
collected 1 item
test_overview_endpoints.tavern.yaml::GET /overview/agents PASSED [100%]
====================================================== 1 passed, 2 warnings in 140.13s (0:02:20) ====================================================== test_rbac_white_overview_endpoints.tavern.yaml(venv) gasti@gasti:~/work/wazuh/api/test/integration$ pytest -vv test_rbac_white_overview_endpoints.tavern.yaml --nobuild
================================================================= test session starts =================================================================
platform linux -- Python 3.10.14, pytest-7.3.1, pluggy-1.5.0 -- /home/gasti/work/wazuh/venv/bin/python
cachedir: .pytest_cache
metadata: {'Python': '3.10.14', 'Platform': 'Linux-6.1.0-20-amd64-x86_64-with-glibc2.36', 'Packages': {'pytest': '7.3.1', 'pluggy': '1.5.0'}, 'Plugins': {'asyncio': '0.18.1', 'tavern': '1.23.5', 'html': '2.1.1', 'metadata': '3.1.1', 'anyio': '4.1.0', 'trio': '0.8.0', 'aiohttp': '1.0.4'}}
rootdir: /home/gasti/work/wazuh/api/test/integration
configfile: pytest.ini
plugins: asyncio-0.18.1, tavern-1.23.5, html-2.1.1, metadata-3.1.1, anyio-4.1.0, trio-0.8.0, aiohttp-1.0.4
asyncio: mode=auto
collected 1 item
test_rbac_white_overview_endpoints.tavern.yaml::GET /overview/agents PASSED [100%]
====================================================== 1 passed, 2 warnings in 129.38s (0:02:09) ====================================================== test_rbac_black_overview_endpoints.tavern.yaml(venv) gasti@gasti:~/work/wazuh/api/test/integration$ pytest -vv test_rbac_black_overview_endpoints.tavern.yaml --nobuild
================================================================= test session starts =================================================================
platform linux -- Python 3.10.14, pytest-7.3.1, pluggy-1.5.0 -- /home/gasti/work/wazuh/venv/bin/python
cachedir: .pytest_cache
metadata: {'Python': '3.10.14', 'Platform': 'Linux-6.1.0-20-amd64-x86_64-with-glibc2.36', 'Packages': {'pytest': '7.3.1', 'pluggy': '1.5.0'}, 'Plugins': {'asyncio': '0.18.1', 'tavern': '1.23.5', 'html': '2.1.1', 'metadata': '3.1.1', 'anyio': '4.1.0', 'trio': '0.8.0', 'aiohttp': '1.0.4'}}
rootdir: /home/gasti/work/wazuh/api/test/integration
configfile: pytest.ini
plugins: asyncio-0.18.1, tavern-1.23.5, html-2.1.1, metadata-3.1.1, anyio-4.1.0, trio-0.8.0, aiohttp-1.0.4
asyncio: mode=auto
collected 1 item
test_rbac_black_overview_endpoints.tavern.yaml::GET /overview/agents PASSED [100%]
====================================================== 1 passed, 2 warnings in 110.44s (0:01:50) ====================================================== The only one I could reproduce locally was test_rbac_white_agent_endpoints.tavern.yamlE tavern.util.exceptions.TestFailError: Test 'Try to restart a list of agents (Partially allowed, user aware)' failed:
- Key mismatch: (expected["error"] = '2' (type = <class 'int'>), actual["error"] = '1' (type = <class 'int'>))
- Error calling validate function '<function healthcheck_agent_restart at 0x7f288d216440>':
Traceback (most recent call last):
File "/home/gasti/work/wazuh/venv/lib/python3.10/site-packages/tavern/response/base.py", line 152, in _maybe_run_validate_functions
vf(response)
File "/home/gasti/work/wazuh/venv/lib/python3.10/site-packages/tavern/util/extfunctions.py", line 98, in inner
result = func(response, *args, **kwargs)
File "/home/gasti/work/wazuh/api/test/integration/tavern_utils.py", line 511, in healthcheck_agent_restart
check_agentd_started(response, agents_list)
File "/home/gasti/work/wazuh/api/test/integration/tavern_utils.py", line 465, in check_agentd_started
raise ProcessLookupError("The wazuh-agentd daemon was not started after requesting the restart")
ProcessLookupError: The wazuh-agentd daemon was not started after requesting the restart I opened the following issue to investigate the reason behind the failures: #23314. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job @GGP1
Description
Introduces changes to the API integration tests environment to improve its efficiency and reliability.
Tests
Integration burst: artifacts.zip
Test with a branch that is not on remote (no tarball)
The manager image uses the current branch tarball to build Wazuh, if the local branch is not on remote it should fail early.
Logs
Test after pushing the changes
docker.log: docker_log.zip
Logs
Docker images before and after the changes in the docker-compose.yaml
Before the changes we were building one image per node and agent, now we are reusing them.
Before
After
Launching the test with the
--nobuild
flag doesn't recreate the imagesdocker.log: docker_log.zip
Logs
Window 1
Window 2