Skip to content

Separating database for tests and dev #125

Description

@robido

Each time the tests are run, a few random users are created. I can see that a problem when I want to test models, and then the database becomes cluttered really quickly, even if just in dev.

To have two databases, I tried to split env-postgres.env in two files:
env-postgres.env
env-postgres-test.env

Then in docker-compose.test.yml I changed the env_file entry to refer to the new env file.

After that, I run docker-compose up -d

When I try to run the tests, I get an error saying the database does not exist. If I create it manually it works, but more errors are showing because the migrations didn't run automatically. How is the database for the backend automatically created, and how can I do the same for the tests database?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions