From 0b8225e402d5eded4ffdf8bc00cfa352e109a59f Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Mon, 27 Jul 2026 13:33:28 -0500 Subject: [PATCH] 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. --- test/aprsme/partition_manager_test.exs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/aprsme/partition_manager_test.exs b/test/aprsme/partition_manager_test.exs index 0c9edfb..8ed63e4 100644 --- a/test/aprsme/partition_manager_test.exs +++ b/test/aprsme/partition_manager_test.exs @@ -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