End-to-end tests are used to verify the CLI functionality of trestle-bot from a user's perspective, running in a containerized environment.
Before running the end-to-end tests, ensure you have the following prerequisites installed:
- Podman - Container management tool
- Python 3 - Required for test automation
- Poetry - Dependency management
mappings
: This directory contains JSON mappings used with WireMock to mock the Git server endpoints.play-kube.yml
: This file includes Kubernetes resources for deploying the mock API server in a pod.Dockerfile
: The Dockerfile used to build the mock server container image.
To run the end-to-end tests, follow these steps:
-
Clone the project repository:
git clone https://github.com/RedHatProductSecurity/trestle-bot.git cd trestle-bot
-
Install the project dependencies:
poetry install --without dev --no-root
-
Run the tests:
make test-e2e
Note: This should always be run from the root of the project directory.
-
The WireMock tool is used to mock Git server endpoints for testing.
-
Podman is used for container and pod management and to build the container image for the mock API server.
-
If the images are not already built, the
make test-e2e
command will build them automatically and remove them at the end of the test. If not, you can build them manually with the following command from the root of the project directory:podman build -t localhost/mock-server:latest -f tests/e2e/Dockerfile tests/e2e podman build -t localhost/trestlebot:latest -f Dockerfile . # Use a prebuilt image from quay.io podman pull quay.io/continuouscompliance/trestle-bot:latest export TRESTLEBOT_IMAGE=quay.io/continuouscompliance/trestle-bot:latest
-
When created tests that push to a branch, ensure the name is "test". This is because the mock API server is configured to only allow pushes to a branch named "test".