-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add integration testing of schema mismatch behaviour (#232)
* chore: update catalyst-ci version * feat: add intregation test target for schema mismatch behaviour * fix: update deny.toml * chore: simplify pyproject * fix: add name to docker-compose * chore: tweak Earthfiles to play nice with CI * fix: spelling
- Loading branch information
1 parent
1c5212b
commit c69de9a
Showing
12 changed files
with
412 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
VERSION --global-cache 0.7 | ||
|
||
builder: | ||
FROM github.com/input-output-hk/catalyst-ci/earthly/python:v2.7.0+python-base | ||
|
||
COPY --dir ./schema_mismatch README.md . | ||
DO github.com/input-output-hk/catalyst-ci/earthly/python:v2.7.0+BUILDER | ||
|
||
package-tester: | ||
FROM +builder | ||
|
||
CMD poetry run pytest | ||
# The following is useful for debugging the tests | ||
# CMD poetry run pytest -vvvv --capture tee-sys --show-capture=stderr | ||
|
||
test: | ||
FROM earthly/dind:alpine | ||
|
||
ARG DB_URL="postgres://catalyst-event-dev:CHANGE_ME@event-db/CatalystEventDev" | ||
ARG CAT_ADDRESS="0.0.0.0:3030" | ||
|
||
WORKDIR /default | ||
COPY ./docker-compose.yml . | ||
|
||
WITH DOCKER \ | ||
--compose docker-compose.yml \ | ||
--load event-db:latest=(../../event-db+build --with_historic_data=false) \ | ||
--load cat-gateway:latest=(../+package-cat-gateway --address=$CAT_ADDRESS --db_url=$DB_URL) \ | ||
--load test:latest=(+package-tester) \ | ||
--service event-db \ | ||
--service cat-gateway \ | ||
--allow-privileged | ||
RUN docker run --network=default_default test | ||
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Integration testing for DB Schema Version Mismatch behavior | ||
|
||
Sets up a containerized environment with the `EventDB` and `catalyst-gateway` services running. | ||
|
||
Integration tests are run in this environment that probe the behavior of the `catalyst-gateway` service in situations | ||
where the DB schema version changes during execution, and creates a mismatch with the version that gateway service expects. | ||
|
||
## Running | ||
|
||
To run: | ||
|
||
```bash | ||
earthly -P +test | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
version: "3" | ||
|
||
services: | ||
event-db: | ||
image: event-db:latest | ||
environment: | ||
# Required environment variables for migrations | ||
- DB_HOST=localhost | ||
- DB_PORT=5432 | ||
- DB_NAME=CatalystEventDev | ||
- DB_DESCRIPTION="Catalyst Event DB" | ||
- DB_SUPERUSER=postgres | ||
- DB_SUPERUSER_PASSWORD=postgres | ||
- DB_USER=catalyst-event-dev | ||
- DB_USER_PASSWORD=CHANGE_ME | ||
|
||
- INIT_AND_DROP_DB=true | ||
- WITH_MIGRATIONS=true | ||
- WITH_SEED_DATA=true | ||
ports: | ||
- 5432:5432 | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U $${DB_SUPERUSER} -d $${DB_SUPERUSER_PASSWORD}"] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 10 | ||
|
||
cat-gateway: | ||
image: cat-gateway:latest | ||
hostname: gateway | ||
ports: | ||
- 3030:3030 | ||
depends_on: | ||
event-db: | ||
condition: service_healthy |
Oops, something went wrong.