Why is the database truncated when using test parallalization?

This one really caught me off guard:


I run an unusual database structure, but I think this would catch standard users off guard too.

With the default config for tests in Rails 6.1:

parallelize(workers: :number_of_processors)

the database gets truncated just before the tests run. This seems to have been put in place to support the new, more complicated database structure support.

In my case, I’m seeding a bunch of data into the database and this just wipes it out.

I was wondering what the purpose was for this and if there’s a way to work around it other than disabling the parallel testing feature?

The change seems to have come in here:



Oh I get it! The parallelisation creates copies of the database with a numerical suffix:


This completely won’t work with my setup so it makes sense to not use this feature.

Took a while to join all the dots lol :slight_smile: :grin: