-
Notifications
You must be signed in to change notification settings - Fork 0
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
🐋 Dockerfile migrations #77
Conversation
Codecov Report
@@ Coverage Diff @@
## main #77 +/- ##
=======================================
Coverage 82.87% 82.87%
=======================================
Files 9 9
Lines 292 292
=======================================
Hits 242 242
Misses 50 50
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@@ -2,6 +2,9 @@ name: 🧪 Integration Tests | |||
|
|||
on: [push, pull_request, workflow_dispatch] | |||
|
|||
env: | |||
DB_URL: postgresql://postgres:postgres@postgres:5432/chowda-test | |||
|
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.
i think DB_URL will get overridden when the tests are run, i.e.
- CHOWDA_ENV gets set to "test" automatically whenever running pytest
- the .env.test is loaded, which contains the DB_URL
at least that's how it's supposed to work. Is it erroring without this explicit env var setting?
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.
Yes, and:
.env.test
contains test values for testing from a local machine (db: localhost)- For CI, we override that with the url for the postgres service
- Because we removed
override=True
, we can just set this variable, instead of:- Create
.env.ci
withDB_URL
- Set
CHOWDA_ENV=CI
- Add a switch case in
conftest.py
for CI
- Create
- Because we removed
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.
Bug
When I fixed the CI file, the tests had this bug: https://github.com/WGBH-MLA/chowda/actions/runs/5479062625/jobs/9980381904
E sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server at "localhost" (::1), port 5432 failed: FATAL: database "chowda-development" does not exist
Import order
Fixing the import order in conftest.py
then used the correct dotfile: https://github.com/WGBH-MLA/chowda/actions/runs/5479131791/jobs/9980556927
E sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server at "localhost" (::1), port 5432 failed: FATAL: database "chowda-test" does not exist
Override
Setting env: DB_URL
successfully connected to the db and ran the tests ✅ : https://github.com/WGBH-MLA/chowda/actions/runs/5479229000/jobs/9980783510
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.
👍
* docs: Removes old note Fixes DB_NAME env Fixes lint errors Changes SonyCiAsset.id to int 🐋 Dockerfile migrations (#77) 💽 `postgresql://` in all environments (#73) Removes dotenv override (#72) 🤖 Update dependencies (#61) 👣 Migration tool (#62) Adds on: workflow_dispatch to all actions (#63) Updates another workflow pointer (#60) ☝️ Updates workflow pointer (#59) Sets chowda db name for CI to 'chowda'
Migrations
Adds migration files to Dockerfile
Test variables
Fixes config import order for pytest.
chowda-development
environ['CHOWDA_ENV'] = 'test'
CI
Adds correct
DB_URL
env to point to postgres service