Parallelize tests throws `PG::InternalError` mentioning `spatial_ref_sys`
mcfoton opened this issue ยท 1 comments
Hi and first of all, much thanks for your work ๐
I did check the related issue, but I am still getting this error when running parallelized tests:
PG::InternalError: ERROR: Cannot find SRID (4326) in spatial_ref_sys
I am running 7.1.1
and I see that the gem's override for truncate_tables
method is called, but the spatial_ref_sys
is already empty at this point.
I could track down the issue to ActiveRecord::TestDatabases
, where it calls create_and_load_schema
. Original test
database does have 8500 records in the table, but for parallelization Rails creates new databases with names like test-1
which are completely empty. Eventually the execution gets to ActiveRecord::Tasks::DatabaseTasks
and because schema_up_to_date?
returns true
, it just calls truncate_tables
. I don't see any point in the code, where the spatial_ref_sys
table is populated with values.
I'm sure I may be missing something rather simple, any help would be appreciated.
Classic... solved it only few minutes after. So the trick is that in our case the test-0
, test-1
... databases were created with the 7.1.0
version of the gem, and the spatial_ref_sys
was truncated. Then we upgraded the gem, but the databases were kept as is. So all I had to do was to run
dbdrop "test-1"
dbdrop "test-2"
...
And on the next test run this databases were recreated with correct content of the spatial_ref_sys
table.