mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 17:08:53 +00:00
Added debug info to TestUpdateStatsOnReplica (#19825)
To debug occasional CI failures.
This commit is contained in:
parent
27d25b7874
commit
8d5914b6fb
1 changed files with 16 additions and 1 deletions
|
|
@ -3,6 +3,7 @@ package service
|
|||
import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"github.com/fleetdm/fleet/v4/server/contexts/ctxdb"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
|
@ -256,7 +257,21 @@ func testUpdateStats(t *testing.T, ds *mysql.Datastore, usingReplica bool) {
|
|||
}()
|
||||
select {
|
||||
case <-time.After(2 * time.Second):
|
||||
t.Fatal("Timeout waiting for aggregated stats")
|
||||
// We fail the test. Gather information for debug.
|
||||
// Grab stats from primary DB (master)
|
||||
lastErr := ""
|
||||
if err != nil {
|
||||
lastErr = err.Error()
|
||||
}
|
||||
aggStats, err = mysql.GetAggregatedStats(
|
||||
ctxdb.RequirePrimary(ctx, true), svc.ds.(*mysql.Datastore), fleet.AggregatedStatsTypeScheduledQuery, queryID,
|
||||
)
|
||||
if err != nil {
|
||||
t.Logf("Error getting aggregated stats from primary DB: %s", err.Error())
|
||||
} else {
|
||||
t.Logf("Aggregated stats from primary DB: totalExecutions=%f %#v", *aggStats.TotalExecutions, aggStats)
|
||||
}
|
||||
t.Fatalf("Timeout waiting for aggregated stats. Last error: %s", lastErr)
|
||||
case <-done:
|
||||
// Continue
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue