generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Use a (local) test DB for load tests so it doesn't wipe out the regular local DB #1074
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: "3.7" | ||
|
||
services: | ||
postgresql-test: | ||
image: postgres:16 | ||
restart: unless-stopped | ||
environment: | ||
POSTGRES_DB: "intermediary-test" | ||
POSTGRES_PASSWORD: "changeIT!" # pragma: allowlist secret | ||
POSTGRES_USER: "intermediary" | ||
ports: | ||
- 5434:5432 | ||
volumes: | ||
- ti_postgres_test_data:/var/lib/postgresql/data | ||
|
||
volumes: | ||
ti_postgres_test_data: |
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 |
---|---|---|
|
@@ -4,8 +4,8 @@ set -e | |
start_api() { | ||
echo 'Starting API' | ||
export DB_URL=localhost | ||
export DB_PORT=5433 | ||
export DB_NAME=intermediary | ||
export DB_PORT=5434 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was this port changed to 5434? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so that if you have the regular local DB already up and running, this won't conflict with or kill it |
||
export DB_NAME=intermediary-test | ||
export DB_USER=intermediary | ||
export DB_PASS=changeIT! | ||
export DB_SSL=require | ||
|
@@ -16,14 +16,14 @@ start_api() { | |
|
||
start_database() { | ||
echo 'Starting database' | ||
docker compose -f docker-compose.postgres.yml up -d | ||
docker compose -f docker-compose.postgres-test.yml up -d | ||
sleep 2 | ||
echo "Database started" | ||
} | ||
|
||
migrate_database() { | ||
echo 'Migrating database' | ||
liquibase update --changelog-file ./etor/databaseMigrations/root.yml --url jdbc:postgresql://localhost:5433/intermediary --username intermediary --password 'changeIT!' --label-filter '!azure' | ||
liquibase update --changelog-file ./etor/databaseMigrations/root.yml --url jdbc:postgresql://localhost:5434/intermediary-test --username intermediary --password 'changeIT!' --label-filter '!azure' | ||
echo "Database migrated" | ||
} | ||
|
||
|
@@ -54,9 +54,9 @@ cleanup() { | |
kill "${API_PID}" | ||
echo "PID ${API_PID} killed" | ||
echo "Stopping and deleting database" | ||
docker stop trusted-intermediary-postgresql-1 | ||
docker rm -f trusted-intermediary-postgresql-1 | ||
docker volume rm trusted-intermediary_ti_postgres_data | ||
docker stop trusted-intermediary-postgresql-test-1 | ||
docker rm -f trusted-intermediary-postgresql-test-1 | ||
docker volume rm trusted-intermediary_ti_postgres_test_data | ||
echo "Database stopped and deleted" | ||
} | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it supposed to be
5432:5434
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The non-test version is 5433:5432, so this is just incrementing the 5433 to match. I think the first number is the Docker host port (so what any services on your machine or a DB client or whatever would connect to) and the second is the container's port inside docker. Since the two DBs (
intermediary
andintermediary-test
) are running on different containers, it's okay they're both using 5432 (the default postgres port), and then the 5434 is what the load tests connect to