Skip to content
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

How to run tests? #180

Open
SKalt opened this issue Apr 26, 2021 · 1 comment · May be fixed by #184
Open

How to run tests? #180

SKalt opened this issue Apr 26, 2021 · 1 comment · May be fixed by #184

Comments

@SKalt
Copy link

SKalt commented Apr 26, 2021

The question/request: instructions for running the tests from a cold start. Better yet, a script to set up a database server for running the tests.

Here's the story that led to me filing this issue.

To check my development environment, I wanted to run the unit tests. make test was a familiar way to do so. First, that failed since I didn't have my virtualenv activated. Then, the tests failed since I didn't have postgres running. That wasn't unexpected I fired up a server using docker run -p 5432:5432 -d postgres:12-alpine. That command failed since docker.io/library/postgres expects explicit authentication configuration. I set POSTGRES_HOST_AUTH_METHOD=trust, and found out the tests expect the postgres server to have a user with the same username as the current user running the tests.

I couldn't find docs on running the tests, so I copied the ./.circleci/config.yml and ran

docker run -d  \
  -e POSTGRES_HOST_AUTH_METHOD=trust \
  -e POSTGRES_USER=$USER \
  -e POSTGRES_DATABASE=$USER \
  -p 5432:5432 \
  postgres:13

Now tests/test_migra.py::test_singleschema is failing with psycopg2.errors.UndefinedObject: role "postgres" does not exist, and I'm still lost. Hence the issue.

@djrobstep
Copy link
Owner

Hello, thanks for filing this and apols for the slow reply.

The tests could definitely be a lot more configurable/easier - with my own configuration, I just have postgres running locally (and mariadb for schemainspect).

With the user/auth, the tests are expecting to have passwordless access (if you can't do psql $CONNECTIONSTRING and get access without a password prompt, the tests won't work). Try setting the user/database to postgres perhaps?

@provokateurin provokateurin linked a pull request Jul 13, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants