diff --git a/server/mgmt_test.go b/server/mgmt_test.go index d58765b..76c3428 100644 --- a/server/mgmt_test.go +++ b/server/mgmt_test.go @@ -18,6 +18,10 @@ func TestMgmtAPI(t *testing.T) { if m.pg == nil { t.Skip("postgres unavailable — skipping management API test") } + // New starts the notifier and task-archive workers on context.Background(); + // closing the pool stops them from claiming later tests' digest batches + // and archive jobs. + defer m.Close() td := t.TempDir() s := New(context.Background(), m, td, td, td) h := s.Handler() diff --git a/server/task_outcome_test.go b/server/task_outcome_test.go index 4ffaa51..833294b 100644 --- a/server/task_outcome_test.go +++ b/server/task_outcome_test.go @@ -23,6 +23,9 @@ func TestTaskOutcomeCard(t *testing.T) { } taskID, _ := strconv.ParseInt(task.ID, 10, 64) defer func() { _ = m.pg.DeleteTask(taskID) }() + // skill_usage has no foreign keys, so DeleteTask leaves these rows behind, + // and their misses would outrank TestSkillGapsReport's fixture in later runs. + defer func() { _, _ = m.pg.Exec(`DELETE FROM skill_usage WHERE task_id=$1`, taskID) }() if _, err := m.pg.Exec(` INSERT INTO findings(task_id,vulnclass,name,severity,status) VALUES