server: fix stale RetentionPolicy comment + check Scan errors in maintenance test

This commit is contained in:
2026-05-03 23:50:05 +01:00
parent 7d2c2ae1c2
commit ed839aacb4
2 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -72,7 +72,7 @@ func (s *Server) dispatchJob(ctx context.Context, user *store.User,
}
// dispatchJobWithPayload is dispatchJob's variant that lets callers
// fill in structured fields (Includes/Excludes/Tag/RetentionPolicy)
// fill in structured fields (Includes/Excludes/Tag/ForgetGroups/RequiresAdminCreds)
// — used by the per-source-group Run-now path. JobID is filled in
// here; callers leave it zero on the input payload.
func (s *Server) dispatchJobWithPayload(ctx context.Context, user *store.User,
@@ -158,7 +158,9 @@ func TestDispatchMaintenanceForgetSkipsHostWithNoRetention(t *testing.T) {
t.Errorf("unexpected command.run: %+v", got)
}
var n int
_ = st.DB().QueryRow(`SELECT COUNT(*) FROM jobs WHERE host_id = ? AND kind = 'forget'`, hostID).Scan(&n)
if err := st.DB().QueryRow(`SELECT COUNT(*) FROM jobs WHERE host_id = ? AND kind = 'forget'`, hostID).Scan(&n); err != nil {
t.Fatalf("count: %v", err)
}
if n != 0 {
t.Errorf("forget job rows: got %d, want 0", n)
}
@@ -184,7 +186,9 @@ func TestDispatchMaintenancePruneSkipsWithoutAdminCreds(t *testing.T) {
t.Errorf("unexpected command.run: %+v", got)
}
var n int
_ = st.DB().QueryRow(`SELECT COUNT(*) FROM jobs WHERE host_id = ? AND kind = 'prune'`, hostID).Scan(&n)
if err := st.DB().QueryRow(`SELECT COUNT(*) FROM jobs WHERE host_id = ? AND kind = 'prune'`, hostID).Scan(&n); err != nil {
t.Fatalf("count: %v", err)
}
if n != 0 {
t.Errorf("prune job rows: got %d, want 0", n)
}