fix: drop migration-created partitions in partition_manager test setup
The migration pre-creates partitions for today..today+2 at test DB setup
time. When ensure_partitions_exist/0 ran, it found them already existing
and returned {:ok, []}, causing the test assertion to fail.
Drop the pre-created partitions in the setup block so ensure_partitions_exist
has actual work to do and returns a non-empty list.
This commit is contained in:
parent
0742308d10
commit
0b8225e402
1 changed files with 10 additions and 0 deletions
|
|
@ -9,6 +9,16 @@ defmodule Aprsme.PartitionManagerTest do
|
|||
# overlapping ranges with a check_violation. Wipe the parent table
|
||||
# so partition tests can freely create/drop partitions.
|
||||
Repo.delete_all(Packet)
|
||||
|
||||
# Drop partitions that the migration pre-creates for today..today+2
|
||||
# so ensure_partitions_exist/0 has actual work to do in tests.
|
||||
today = Date.utc_today()
|
||||
|
||||
for offset <- 0..2 do
|
||||
name = PartitionManager.partition_name(Date.add(today, offset))
|
||||
Repo.query!("DROP TABLE IF EXISTS #{name}")
|
||||
end
|
||||
|
||||
:ok
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue