Skip to content

Commit

Permalink
Fix end-to-end tests in CI (#3746)
Browse files Browse the repository at this point in the history
* Ensure that end-to-end test run in CI

The `docker compose run` command doesn’t support the `--build-arg` argument. Depending on the Docker Compose version installed, using the `--build-arg` argument would either exit with an error code or simply print the command help.

To achieve the desired outcome, we can first build the image with the build argument, then start the container. This has the additional advantage of separating the build logs from the logs of the actual command execution in the GitHub Actions UI.

* Pull and start services before running tests

This separates logs related to pulling/starting service containers from the logs of the actual test command.
  • Loading branch information
tillprochaska authored May 23, 2024
1 parent 45c6deb commit 42dea7e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ jobs:
docker --version
docker-compose --version
- name: Build e2e image
run: make build-e2e

- name: Pull and start services
run: make services-e2e

- name: Run tests
run: make e2e

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ e2e: services-e2e e2e/test-results
$(COMPOSE_E2E) run --rm app aleph upgrade
$(COMPOSE_E2E) run --rm app aleph createuser --name="E2E Admin" --admin --password="admin" [email protected]
$(COMPOSE_E2E) up -d api ui worker
BASE_URL=http://ui:8080 $(COMPOSE_E2E) run --rm --build-arg PLAYWRIGHT_VERSION=$(shell awk -F'==' '/^playwright==/ { print $$2 }' e2e/requirements.txt) e2e pytest -s -v --output=/e2e/test-results/ --screenshot=only-on-failure --video=retain-on-failure e2e/
BASE_URL=http://ui:8080 $(COMPOSE_E2E) run --rm e2e pytest -s -v --output=/e2e/test-results/ --screenshot=only-on-failure --video=retain-on-failure e2e/

e2e-local-setup: dev
python3 -m pip install -q -r e2e/requirements.txt
Expand Down

0 comments on commit 42dea7e

Please sign in to comment.