Use a temporary docker postgres container for postgres DB sync tests#1243
Use a temporary docker postgres container for postgres DB sync tests#1243austinweisgrau wants to merge 8 commits intomove-coop:mainfrom
Conversation
7197a5c to
db794e8
Compare
|
this is such a great idea!! |
|
If you could run |
Previously, the env var PGPORT would be overridden by the default value 5432. This still works as long as PGPORT isn't set.
prior implementation would not work if a postgres table was defined with a schema, as the quoting of `"schema.table"` is not valid and it needs to be `schema."table"`
this runs the test in a throwaway postgres docker container rather than needing to run the tests on an actual persistent postgres server
92b2160 to
84dcdff
Compare
|
The MacOS test runner does not allow for running docker containers - I made a change in 9d64d41 to skip the tests involving a docker container if docker is not available in the environment |
|
Turns out you can't run docker in a Windows github actions environment either, so I took a slightly more robust skipping approach in 651cb39 |
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ruff==0.13.0 | ||
| testfixtures==8.3.0;python_version<'3.11' | ||
| testfixtures==9.1.0;python_version>='3.11' | ||
| testcontainers==4.9.0 |
There was a problem hiding this comment.
| testcontainers==4.9.0 | |
| testcontainers==4.14.1 |
might as well use the latest version here
| self.host = host or os.environ.get("PGHOST") | ||
| self.db = db or os.environ.get("PGDATABASE") | ||
| self.port = port or os.environ.get("PGPORT") | ||
| self.port = port or os.environ.get("PGPORT") or 5432 |
There was a problem hiding this comment.
should 5432 be a string like in test_postgres.py?
Should follow #1242
Uses the testcontainers package to easily generate and use a temporary postgres docker container for tests. Allows for running tests on postgres without running a persistent server separately, which should enable us to run tests on postgres in the CICD environment.