quarterly pass

This commit is contained in:
Daniel Ponte 2024-11-30 17:44:08 -05:00
parent af9cd3ff48
commit 4d4ce6e9a8

View file

@ -108,9 +108,9 @@ func TestPartman(t *testing.T) {
partResult("calls_p_2024_07", "2024-07-01", "2024-08-01"),
},
expectCreate: []partSpec{
{name:"calls_p_2024_11", timeRange: timeRange{start: dateInUTC("2024-11-01"), end: dateInUTC("2024-12-01")}},
{name:"calls_p_2024_12", timeRange: timeRange{start: dateInUTC("2024-12-01"), end: dateInUTC("2025-01-01")}},
{name:"calls_p_2025_01", timeRange: timeRange{start: dateInUTC("2025-01-01"), end: dateInUTC("2025-02-01")}},
{name: "calls_p_2024_11", timeRange: timeRange{start: dateInUTC("2024-11-01"), end: dateInUTC("2024-12-01")}},
{name: "calls_p_2024_12", timeRange: timeRange{start: dateInUTC("2024-12-01"), end: dateInUTC("2025-01-01")}},
{name: "calls_p_2025_01", timeRange: timeRange{start: dateInUTC("2025-01-01"), end: dateInUTC("2025-02-01")}},
},
expectDrop: []string{
"public.calls_p_2024_07",
@ -206,7 +206,7 @@ func TestPartman(t *testing.T) {
},
{
name: "quarterly base",
now: timeInUTC("2025-07-28 11:37:04"),
now: timeInUTC("2025-07-28 11:37:04"), // q3
cfg: config.Partition{
Enabled: true,
Schema: "public",
@ -222,20 +222,25 @@ func TestPartman(t *testing.T) {
partResult("calls_p_2025_q2", "2025-04-01", "2024-07-01"),
},
expectDrop: []string{
"public.calls_p_2024_11_24",
"public.calls_p_2024_11_25",
"public.calls_p_2024_q3",
"public.calls_p_2024_q4",
},
expectSweep: []timeRange{
{start: dateInUTC("2024-11-24"), end: dateInUTC("2024-11-25")},
{start: dateInUTC("2024-11-25"), end: dateInUTC("2024-11-26")},
{start: dateInUTC("2024-07-01"), end: dateInUTC("2024-10-01")},
{start: dateInUTC("2024-10-01"), end: dateInUTC("2025-01-01")},
},
expectCleanup: []timeRange{
{start: dateInUTC("2024-11-24"), end: dateInUTC("2024-11-25")},
{start: dateInUTC("2024-11-25"), end: dateInUTC("2024-11-26")},
{start: dateInUTC("2024-07-01"), end: dateInUTC("2024-10-01")},
{start: dateInUTC("2024-10-01"), end: dateInUTC("2025-01-01")},
},
expectCreate: []partSpec{
{name: "calls_p_2025_q3", timeRange: timeRange{dateInUTC("2025-07-01"), dateInUTC("2025-10-01")}},
{name: "calls_p_2025_q4", timeRange: timeRange{dateInUTC("2025-10-01"), dateInUTC("2026-01-01")}},
{name: "calls_p_2026_q1", timeRange: timeRange{dateInUTC("2026-01-01"), dateInUTC("2026-04-01")}},
},
expectDetach: []string{
"public.calls_p_2024_11_24",
"public.calls_p_2024_11_25",
"public.calls_p_2024_q3",
"public.calls_p_2024_q4",
},
},
{