feat: add read-only retention inventory
This commit is contained in:
@@ -98,4 +98,15 @@ func TestIntegrationOperationalSnapshot(t *testing.T) {
|
||||
if _, err := ReadOperationalSnapshot(cancelled, db); err == nil {
|
||||
t.Fatal("cancelled context unexpectedly completed snapshot")
|
||||
}
|
||||
f.exec("UPDATE pulse_tasks SET completed_at=DATE_SUB(UTC_TIMESTAMP(6), INTERVAL 2 HOUR), updated_at=UTC_TIMESTAMP(6) WHERE namespace_id=? AND id=?", f.resources.NamespaceID, task.ID)
|
||||
inventory, err := ReadRetentionInventory(ctx, db, time.Now().UTC().Add(-time.Hour))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if inventory.Cutoff.IsZero() || inventory.TerminalTasks == 0 || inventory.UncertainTasks != 0 {
|
||||
t.Fatalf("retention inventory=%+v", inventory)
|
||||
}
|
||||
if _, err := ReadRetentionInventory(ctx, db, time.Now().UTC().Add(time.Hour)); err == nil {
|
||||
t.Fatal("future retention cutoff unexpectedly accepted")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user