MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / TestUpdateCalculatedStatsPanic

Function TestUpdateCalculatedStatsPanic

db/database_test.go:4434–4458  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

4432}
4433
4434func TestUpdateCalculatedStatsPanic(t *testing.T) {
4435
4436 var dbc *DatabaseContext
4437
4438 defer func() {
4439 r := recover()
4440 if r != nil {
4441 t.Errorf("UpdateCalculatedStats panic recovered, stack trace: %s", debug.Stack())
4442 }
4443 }()
4444
4445 // nil DatabaseContext check
4446 ctx := base.TestCtx(t)
4447 dbc.UpdateCalculatedStats(ctx)
4448
4449 // non-nil DatabaseContext, nil stats
4450 dbc = &DatabaseContext{}
4451 dbc.UpdateCalculatedStats(ctx)
4452
4453 // non-nil DatabaseContext and stats, nil channel cache
4454 dbStats, statsError := initDatabaseStats(ctx, "db", false, DatabaseContextOptions{})
4455 require.NoError(t, statsError)
4456 dbc.DbStats = dbStats
4457 dbc.UpdateCalculatedStats(ctx)
4458}
4459
4460func Test_waitForBackgroundManagersToStop(t *testing.T) {
4461 // use testing/synctest to have fake time once go 1.25 is available. In the meantime, windows and -race are

Callers

nothing calls this directly

Calls 4

UpdateCalculatedStatsMethod · 0.95
TestCtxFunction · 0.92
initDatabaseStatsFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected