Search code examples
elixirtravis-ciphoenix-frameworkecto

Phoenix Ecto tests not clearing on travis


The repo I am working on is: https://github.com/inclusiveClassrooms/skills-wheel

When running my tests on a non travis computer, the tests all pass.

On travis the tests now fail. The error says that the user being inserted is not unique. When logging Repo.all(User) here, travis still has a user in the database and the database is not being flushed before each test

Locally Repo.all(User) is an empty list and the database is being flushed correctly.

Why is this database flushing happening locally, but not on travis?

How can I ensure travis tests have a clean database before each test?

Thanks in advance for the help


Solution

  • The reason was because our travis script was also running our seed file.

    The database revert that happens before each test was reverting our tests back to having our seed user inserted