Skip to content

Make tests always pass regardless of ordering

Nicolas Bouilleaud requested to merge active-storage-and-unit-tests into main

Setting use_transactional_tests to false changes the way fixtures are setup and teardown around each test. In transactional mode, the fixtures are inserted before the first suite, then each test is run in a DB transaction, that is rolled back at the end of the test.

The problem is that the fixture files for the active storage blobs are not recreated that way.

When disabling transactional tests, the DB is completely cleared after each test, and the fixtures are completely recreated before each test, including the active storage blobs.

NOTE: when running the tests in parallel (as we do in the CI, or with make test-unit), it’s rare to actually see the test fail, but it fails always when disabling parallelism, or when running just RowTest. I’m not exactly sure why 🤷

Merge request reports