server: fix stale RetentionPolicy comment + check Scan errors in maintenance test
This commit is contained in:
@@ -72,7 +72,7 @@ func (s *Server) dispatchJob(ctx context.Context, user *store.User,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// dispatchJobWithPayload is dispatchJob's variant that lets callers
|
// 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
|
// — used by the per-source-group Run-now path. JobID is filled in
|
||||||
// here; callers leave it zero on the input payload.
|
// here; callers leave it zero on the input payload.
|
||||||
func (s *Server) dispatchJobWithPayload(ctx context.Context, user *store.User,
|
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)
|
t.Errorf("unexpected command.run: %+v", got)
|
||||||
}
|
}
|
||||||
var n int
|
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 {
|
if n != 0 {
|
||||||
t.Errorf("forget job rows: got %d, want 0", n)
|
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)
|
t.Errorf("unexpected command.run: %+v", got)
|
||||||
}
|
}
|
||||||
var n int
|
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 {
|
if n != 0 {
|
||||||
t.Errorf("prune job rows: got %d, want 0", n)
|
t.Errorf("prune job rows: got %d, want 0", n)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user