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

Function writeHistoricalData

modules/blockbuilder/tenant_store_test.go:163–191  ·  view source on GitHub ↗
(t *testing.T, count int, startTime time.Time, cycleDuration, slackDuration time.Duration, traceStart, traceEnd time.Time)

Source from the content-addressed store, hash-verified

161}
162
163func writeHistoricalData(t *testing.T, count int, startTime time.Time, cycleDuration, slackDuration time.Duration, traceStart, traceEnd time.Time) *backend.BlockMeta {
164 var (
165 ctx = t.Context()
166 log = log.NewNopLogger()
167 store = newStoreWithLogger(ctx, t, log, false)
168 )
169
170 ts, err := getTenantStore(t, startTime, cycleDuration, slackDuration)
171 require.NoError(t, err)
172
173 for i := 0; i < count; i++ {
174 req := test.MakePushBytesRequest(t, 3, nil, uint64(traceStart.UnixNano()), uint64(traceEnd.UnixNano()))
175 for j := range req.Traces {
176 err = ts.AppendTrace(req.Ids[j], req.Traces[j].Slice, startTime)
177 require.NoError(t, err)
178 }
179 }
180
181 err = ts.Flush(ctx, store, store, store)
182 require.NoError(t, err)
183 err = ts.AllowCompaction(ctx, store)
184 require.NoError(t, err)
185
186 store.PollNow(ctx)
187 metas := store.BlockMetas(ts.tenantID)
188 require.Equal(t, 1, len(metas))
189
190 return metas[0]
191}
192
193func TestTenantStoreNoCompactFlag(t *testing.T) {
194 var (

Callers 1

Calls 10

MakePushBytesRequestFunction · 0.92
getTenantStoreFunction · 0.85
AllowCompactionMethod · 0.80
newStoreWithLoggerFunction · 0.70
ContextMethod · 0.65
AppendTraceMethod · 0.65
FlushMethod · 0.65
PollNowMethod · 0.65
BlockMetasMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected