MCPcopy
hub / github.com/grafana/tempo / TestTenantIndexPollError

Function TestTenantIndexPollError

tempodb/blocklist/poller_test.go:497–521  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

495}
496
497func TestTenantIndexPollError(t *testing.T) {
498 p := NewPoller(&PollerConfig{
499 StaleTenantIndex: time.Minute,
500 }, nil, nil, nil, nil, log.NewNopLogger())
501
502 // tenant index doesn't matter if there's an error
503 assert.Error(t, p.tenantIndexPollError(nil, errors.New("blerg")))
504
505 // tenant index older than 1 minute is stale, error!
506 assert.Error(t, p.tenantIndexPollError(&backend.TenantIndex{
507 CreatedAt: time.Now().Add(-5 * time.Minute),
508 }, nil))
509
510 // no error, tenant index is within 1 minute
511 assert.NoError(t, p.tenantIndexPollError(&backend.TenantIndex{
512 CreatedAt: time.Now().Add(-time.Second),
513 }, nil))
514
515 p = NewPoller(&PollerConfig{}, nil, nil, nil, nil, log.NewNopLogger())
516
517 // no error, index is super old but stale tenant index is 0
518 assert.NoError(t, p.tenantIndexPollError(&backend.TenantIndex{
519 CreatedAt: time.Now().Add(30 * time.Hour),
520 }, nil))
521}
522
523func TestBlockListBackendMetrics(t *testing.T) {
524 tests := []struct {

Callers

nothing calls this directly

Calls 5

tenantIndexPollErrorMethod · 0.95
NewPollerFunction · 0.85
ErrorMethod · 0.65
AddMethod · 0.65
NowMethod · 0.65

Tested by

no test coverage detected