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

Function TestShardedIntegration

modules/backendscheduler/integration_test.go:21–65  ·  view source on GitHub ↗

TestShardedIntegration verifies that sharded work can be used as a drop-in replacement

(t *testing.T)

Source from the content-addressed store, hash-verified

19
20// TestShardedIntegration verifies that sharded work can be used as a drop-in replacement
21func TestShardedIntegration(t *testing.T) {
22 tests := []struct {
23 name string
24 }{
25 {"sharded_work"},
26 }
27
28 for _, tt := range tests {
29 t.Run(tt.name, func(t *testing.T) {
30 tmpDir := t.TempDir()
31
32 // Create config with or without sharding
33 cfg := Config{}
34 cfg.RegisterFlagsAndApplyDefaults("", &flag.FlagSet{})
35 cfg.LocalWorkPath = tmpDir + "/work"
36 // Prevent the compaction provider from picking up test blocks as in-flight
37 // compaction jobs (which would filter them from SubmitRedaction's view).
38 cfg.ProviderConfig.Compaction.MinInputBlocks = 100
39
40 var (
41 ctx, cancel = context.WithCancel(context.Background())
42 store, rr, ww = newStore(ctx, t, tmpDir)
43 )
44 defer func() {
45 cancel()
46 store.Shutdown()
47 }()
48
49 limits, err := overrides.NewOverrides(overrides.Config{Defaults: overrides.Overrides{}}, nil, prometheus.DefaultRegisterer)
50 require.NoError(t, err)
51
52 scheduler, err := New(cfg, store, limits, rr, ww)
53 require.NoError(t, err)
54
55 err = scheduler.starting(ctx)
56 require.NoError(t, err)
57
58 testJobOperations(ctx, t, scheduler)
59
60 testPersistenceAndRecovery(ctx, t, scheduler, cfg, store, limits, rr, ww)
61
62 testSubmitRedactionPersistence(ctx, t, scheduler, cfg, store, limits, rr, ww)
63 })
64 }
65}
66
67func testJobOperations(ctx context.Context, t *testing.T, scheduler *BackendScheduler) {
68 // Add some jobs

Callers

nothing calls this directly

Calls 10

NewOverridesFunction · 0.92
testJobOperationsFunction · 0.85
newStoreFunction · 0.70
ShutdownMethod · 0.65
NewFunction · 0.50
RunMethod · 0.45
startingMethod · 0.45

Tested by

no test coverage detected