fix: drop migration-created partitions in partition_manager test setup
Some checks failed
Elixir CI / Build and test (push) Successful in 3m3s
Elixir CI / Dialyzer (push) Failing after 5m30s
Elixir CI / Build and Push Docker Image (push) Has been skipped

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:
Graham McIntire 2026-07-27 13:33:28 -05:00
parent 0742308d10
commit 0b8225e402
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59

View file

@ -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