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 API integration tests conftest directives #22891

Closed
7 tasks done
GGP1 opened this issue Apr 11, 2024 · 3 comments · Fixed by #23204
Closed
7 tasks done

Fix API integration tests conftest directives #22891

GGP1 opened this issue Apr 11, 2024 · 3 comments · Fixed by #23204
Assignees
Labels
level/task type/bug Something isn't working

Comments

@GGP1
Copy link
Member

GGP1 commented Apr 11, 2024

Description

The API integration tests conftest.py file contains some errors that are causing the tests execution to not behave as expected in the 20748-upgrade-to-connexion-3 branch.

Tasks

  • When the environment was created using a profile, the down_env directive is not tearing down the containers successfully. We should include the following changes:
+ def down_env(env_mode: str):
    """Stop and remove all Docker containers."""
    os.chdir(env_path)
    with open(docker_log_path, mode='a') as f_docker:
+       current_process = subprocess.Popen(["docker", "compose", "--profile", env_mode, "down"], stdout=f_docker,
                                           stderr=subprocess.STDOUT, universal_newlines=True)
        current_process.wait()
    os.chdir(current_path)
  • Not related to the conftest itself but it could be handy to have a .env file next to the docker-compose to specify the values of the variables ENV_MODE and WAZUH_LOCAL_PATH there instead of doing it on every command.

  • Review why the agents depend on the one deployed earlier. They shouldn't depend on each other.

depends_on:
- wazuh-agent1
- nginx-lb

Checks

The following elements have been updated or reviewed (should also be checked if no modification is required):

  • Tests (unit tests, API integration tests).
  • Changelog.
  • Documentation.
  • Integration test mapping (using api/test/integration/mapping/_test_mapping.py).
@GGP1 GGP1 added type/bug Something isn't working level/task labels Apr 11, 2024
@GGP1 GGP1 self-assigned this Apr 30, 2024
@GGP1
Copy link
Member Author

GGP1 commented Apr 30, 2024

Update

Made modifications to the AIT environment to improve its efficiency and reliability.

@GGP1 GGP1 linked a pull request Apr 30, 2024 that will close this issue
@GGP1
Copy link
Member Author

GGP1 commented May 3, 2024

Update

Investigated about building the manager docker image locally but it requires to move the Dockerfile to the top of the repository I discarded it. Also, fixed a dependency issue between nginx and the workers and updated a test which was failing because an agent could reconnect before the test ended.

@GGP1
Copy link
Member Author

GGP1 commented May 6, 2024

Update

Modified the conftest to fail when the request is not successful and the code is not 404. Ran all integration tests on jenkins and compared them to 4.9.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level/task type/bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants