-
Notifications
You must be signed in to change notification settings - Fork 4
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
Live database support #13
Comments
I was very interested in this also. I think I have it working with this
Setting that environment variable to Does this work for you too? |
@ash211 I can also can say this worked well for me and is worth official support as a PR. Within gitlab's services infra: https://docs.gitlab.com/ee/ci/services/postgres.html, I found setting the hostname to |
To the best of my understanding, this "magically" uses the Postgresql executable to create a separate database. This works great for testing on my machine, but when I want to run these test on my CI environment (using gitlab's ci/cd toolchain) I run into a problem.
I either need to install postgresql on the docker image the tests run on or use a pre installed postgresql image. further when I try these approaches I run into other problems, for example it doesn't like that the tests are running as root.
Ideally, I could still have a way to use a live database, which you can setup and demolish using
"services": postgres:latest
in the.gitlab-ci.yml
file as part of the normal CI pipeline.For the time being, I will probably add a fixture to conftest.py that checks some environment variables and either returns a real postgresql db context or a pytest-psql postgresql_db context depending on the environment.
Would be cool if i could just set some options to pass a real database connection details instead.
Apologies if this is already possible I couldn't find out how.
The text was updated successfully, but these errors were encountered: