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

Function TestBackendScheduler

integration/storage/backend_scheduler_test.go:30–268  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28)
29
30func TestBackendScheduler(t *testing.T) {
31 util.RunIntegrationTests(t, util.TestHarnessConfig{
32 Components: util.ComponentsBackendWork,
33 Backends: util.BackendObjectStorageAll,
34 ConfigOverlay: "config-backend-scheduler.yaml",
35 }, func(h *util.TempoHarness) {
36 ctx, cancel := context.WithCancel(context.Background())
37 defer cancel()
38
39 s := h.TestScenario
40
41 // Get the config from the harness
42 cfg, err := h.GetConfig()
43 require.NoError(t, err)
44
45 objStorage := h.Services[util.ServiceObjectStorage]
46 backendEndpoint := objStorage.HTTPEndpoint()
47 t.Logf("Endpoint: %s", backendEndpoint)
48
49 // Get the scheduler and worker services from the harness
50 scheduler := h.Services[util.ServiceBackendScheduler]
51 worker := h.Services[util.ServiceBackendWorker]
52
53 // Stop the worker initially - we'll start it later after populating data
54 require.NoError(t, s.Stop(worker))
55
56 // Setup tempodb with local backend
57 tempodbWriter := setupBackendWithEndpoint(t, &cfg.StorageConfig.Trace, backendEndpoint)
58
59 cases := []struct {
60 name string
61 tenantCount int
62 blockCount int
63 expectedBlocks int // accumulated expected blocks. Each test adds this to the total
64 expectedOutstandingBlocks int // accumulated expected outstanding blocks. Each test adds this to the total, but 1 outstanding block is between 2-4 blocks.
65 }{
66 {
67 name: "a bunch of tenants with 1 block each is 0 outstanding",
68 tenantCount: 11,
69 blockCount: 1,
70 expectedBlocks: 1,
71 expectedOutstandingBlocks: 0,
72 },
73 {
74 name: "a bunch of tenants with 12 blocks each 12 outstanding",
75 tenantCount: 11,
76 blockCount: 12,
77 expectedBlocks: 12,
78 expectedOutstandingBlocks: 12,
79 },
80 }
81 var tenants []string
82
83 type expectations struct {
84 blocks int
85 outstanding int
86 }
87

Callers

nothing calls this directly

Calls 13

RunIntegrationTestsFunction · 0.92
setupBackendWithEndpointFunction · 0.85
populateBackendFunction · 0.85
printMetricValueFunction · 0.85
GetConfigMethod · 0.80
EqualsMethod · 0.80
StopMethod · 0.65
SleepMethod · 0.65
LenMethod · 0.65
ErrorMethod · 0.65
RunMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected