(t *testing.T)
| 495 | } |
| 496 | |
| 497 | func 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 | |
| 523 | func TestBlockListBackendMetrics(t *testing.T) { |
| 524 | tests := []struct { |
nothing calls this directly
no test coverage detected