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

Function TestPollerOwnership

integration/storage/poller_test.go:42–163  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

40}
41
42func TestPollerOwnership(t *testing.T) {
43 storageBackendTestPermutations := []struct {
44 name string
45 prefix string
46 }{
47 {
48 name: "empty-string-prefix",
49 prefix: "",
50 },
51 {
52 name: "no-prefix",
53 },
54 {
55 name: "prefix",
56 prefix: "a/b/c/",
57 },
58 {
59 name: "prefix-no-trailing-slash",
60 prefix: "a/b/c",
61 },
62 }
63
64 logger := log.NewLogfmtLogger(os.Stdout)
65
66 for _, pc := range storageBackendTestPermutations {
67 t.Run(pc.name, func(t *testing.T) {
68 util.RunIntegrationTests(t, util.TestHarnessConfig{
69 DeploymentMode: util.DeploymentModeNone,
70 Backends: util.BackendObjectStorageAll,
71 }, func(h *util.TempoHarness) {
72 // Get the config to determine backend type and settings
73 cfg, err := h.GetConfig()
74 require.NoError(t, err)
75
76 var rr backend.RawReader
77 var ww backend.RawWriter
78 var cc backend.Compactor
79
80 listBlockConcurrency := 10
81
82 // Get backend endpoint from the harness
83 objStorage := h.Services[util.ServiceObjectStorage]
84 e := objStorage.Endpoint(objStorage.HTTPPort())
85
86 switch cfg.StorageConfig.Trace.Backend {
87 case backend.S3:
88 cfg.StorageConfig.Trace.S3.ListBlocksConcurrency = listBlockConcurrency
89 cfg.StorageConfig.Trace.S3.Endpoint = e
90 cfg.StorageConfig.Trace.S3.Prefix = pc.prefix
91 rr, ww, cc, err = s3.New(cfg.StorageConfig.Trace.S3)
92 case backend.GCS:
93 cfg.StorageConfig.Trace.GCS.ListBlocksConcurrency = listBlockConcurrency
94 cfg.StorageConfig.Trace.GCS.Endpoint = e
95 cfg.StorageConfig.Trace.GCS.Prefix = pc.prefix
96 rr, ww, cc, err = gcs.New(cfg.StorageConfig.Trace.GCS)
97 case backend.Azure:
98 cfg.StorageConfig.Trace.Azure.Endpoint = e
99 cfg.StorageConfig.Trace.Azure.Prefix = pc.prefix

Callers

nothing calls this directly

Calls 15

ListBlocksMethod · 0.95
DoMethod · 0.95
RunIntegrationTestsFunction · 0.92
NewFunction · 0.92
NewFunction · 0.92
NewFunction · 0.92
NewReaderFunction · 0.92
NewWriterFunction · 0.92
NewPollerFunction · 0.92
CreateBlockBoundariesFunction · 0.92
NewFunction · 0.92
pushBlocksToTenantFunction · 0.85

Tested by

no test coverage detected