Skip to content

Commit

Permalink
Script to iterate over test fixtures and apply
Browse files Browse the repository at this point in the history
  • Loading branch information
jonkafton committed Feb 7, 2024
1 parent 5adaccf commit b22266d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/e2e-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ jobs:
- name: Build frontend
run: MITOPEN_HOSTNAME=nginx:8063 yarn build

- name: Run services and E2E tests
run: |
docker compose -f docker-compose-e2e-tests.yml build
docker compose -f docker-compose-e2e-tests.yml up nginx web db --detach --wait
docker compose -f docker-compose-e2e-tests.yml cp e2e_testing/fixtures/002_carousel.sql db:/002_carousel.sql
docker compose -f docker-compose-e2e-tests.yml exec -u postgres db psql postgres postgres -f /002_carousel.sql
docker compose -f docker-compose-e2e-tests.yml run e2e-tests
docker compose -f docker-compose-e2e-tests.yml down
- name: Build services
run: docker compose -f docker-compose-e2e-tests.yml build

- name: Start services
run: docker compose -f docker-compose-e2e-tests.yml up nginx web db --detach --wait

- name: Apply test data
run: ./e2e_testing/scripts/apply-fixtures.sh

- name: Run E2E tests
run: docker compose -f docker-compose-e2e-tests.yml run e2e-tests
12 changes: 12 additions & 0 deletions e2e_testing/scripts/apply-fixtures.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

directory="e2e_testing/fixtures"

for path in "$directory"/*; do
if [ -f "$path" ]; then
file=$(basename $path)
echo "Applying: $file"
docker compose -f docker-compose-e2e-tests.yml cp $path db:/$file
docker compose -f docker-compose-e2e-tests.yml exec -u postgres db psql postgres postgres -f /$file
fi
done

0 comments on commit b22266d

Please sign in to comment.