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

Function pushBlocksToTenant

integration/storage/poller_test.go:365–411  ·  view source on GitHub ↗
(t *testing.T, tenant string, bb [][]byte, w backend.Writer)

Source from the content-addressed store, hash-verified

363}
364
365func pushBlocksToTenant(t *testing.T, tenant string, bb [][]byte, w backend.Writer) []uuid.UUID {
366 // Randomly pick a block boundary
367 r := mathrand.IntN(len(bb))
368
369 base := bb[r]
370 t.Logf("base: %v", base)
371 expected := []uuid.UUID{}
372
373 // Include the min and max in each tenant for testing
374 expected = append(expected, uuid.MustParse("00000000-0000-0000-0000-000000000000"))
375 expected = append(expected, uuid.MustParse("ffffffff-ffff-ffff-ffff-ffffffffffff"))
376
377 // If we are above zero, then we have room to decrement
378 if r > 0 {
379 decrementUUIDBytes(base)
380 expected = append(expected, uuid.UUID(base))
381 }
382
383 // If we are n-1 then we have room to increment
384 if r < len(bb)-1 {
385 // Grab the one after the boundary
386 incrementUUIDBytes(base)
387 expected = append(expected, uuid.UUID(base))
388 }
389
390 // If we are n-2 then we have room to increment again
391 if r < len(bb)-2 {
392 // Grab the one after the boundary
393 incrementUUIDBytes(base)
394 expected = append(expected, uuid.UUID(base))
395 }
396
397 // If we are n-3 then we have room to increment again
398 if r < len(bb)-3 {
399 // Grab the one after the boundary
400 incrementUUIDBytes(base)
401 expected = append(expected, uuid.UUID(base))
402 }
403
404 // Write the blocks using the expectaed block IDs
405 writeTenantBlocks(t, w, tenant, expected)
406
407 sort.Slice(expected, func(i, j int) bool { return expected[i].String() < expected[j].String() })
408 // t.Logf("expected: %v", expected)
409
410 return expected
411}

Callers 1

TestPollerOwnershipFunction · 0.85

Calls 4

decrementUUIDBytesFunction · 0.85
incrementUUIDBytesFunction · 0.85
writeTenantBlocksFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected