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

Function TestPollBlockWithNoCompactFlag

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

Source from the content-addressed store, hash-verified

389}
390
391func TestPollBlockWithNoCompactFlag(t *testing.T) {
392 blockID := backend.MustParse("00000000-0000-0000-0000-000000000001")
393 blockUUID := uuid.MustParse(blockID.String())
394 tenantID := "test"
395
396 tests := []struct {
397 name string
398 hasNoCompactFlag bool
399 noCompactFlagError error
400 skipNoCompactBlocks bool
401 expectedMeta *backend.BlockMeta
402 expectedNoCompactCalls int
403 expectedBlockMetaCalls int
404 wantErr bool
405 }{
406 {
407 name: "block without nocompact flag is included",
408 hasNoCompactFlag: false,
409 skipNoCompactBlocks: true,
410 expectedMeta: &backend.BlockMeta{BlockID: blockID, TenantID: tenantID},
411 expectedNoCompactCalls: 1,
412 expectedBlockMetaCalls: 1,
413 wantErr: false,
414 },
415 {
416 name: "block with nocompact flag is excluded",
417 hasNoCompactFlag: true,
418 skipNoCompactBlocks: true,
419 expectedMeta: nil,
420 expectedNoCompactCalls: 1,
421 expectedBlockMetaCalls: 0, // no calls for excluded block
422 wantErr: false,
423 },
424 {
425 name: "block with nocompact flag is included if skipNoCompactBlocks is false",
426 hasNoCompactFlag: true,
427 skipNoCompactBlocks: false,
428 expectedMeta: &backend.BlockMeta{BlockID: blockID, TenantID: tenantID},
429 expectedNoCompactCalls: 0, // no compact check calls
430 expectedBlockMetaCalls: 1,
431 wantErr: false,
432 },
433 {
434 name: "block with nocompact flag check error is excluded",
435 hasNoCompactFlag: false,
436 skipNoCompactBlocks: true,
437 noCompactFlagError: errors.New("flag check error"),
438 expectedMeta: nil,
439 expectedNoCompactCalls: 1,
440 expectedBlockMetaCalls: 0, // no calls for errored block
441 wantErr: true,
442 },
443 }
444
445 for _, tc := range tests {
446 t.Run(tc.name, func(t *testing.T) {
447 r := &backend.MockReader{
448 T: []string{tenantID},

Callers

nothing calls this directly

Calls 8

pollBlockMethod · 0.95
MustParseFunction · 0.92
UUIDTypeAlias · 0.92
NewPollerFunction · 0.85
ErrorMethod · 0.65
StringMethod · 0.45
RunMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected