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

Function testSearch

tempodb/wal/wal_test.go:221–248  ·  view source on GitHub ↗
(t *testing.T, e encoding.VersionedEncoding)

Source from the content-addressed store, hash-verified

219}
220
221func testSearch(t *testing.T, e encoding.VersionedEncoding) {
222 runWALTest(t, e.Version(), func(ids [][]byte, objs []*tempopb.Trace, block common.WALBlock) {
223 ctx := context.Background()
224
225 for i, o := range objs {
226 k, v := findFirstAttribute(o)
227 require.NotEmpty(t, k)
228 require.NotEmpty(t, v)
229
230 resp, err := block.Search(ctx, &tempopb.SearchRequest{
231 Tags: map[string]string{
232 k: v,
233 },
234 Limit: 10,
235 }, common.DefaultSearchOptions())
236 if errors.Is(err, util.ErrUnsupported) {
237 return
238 }
239 require.NoError(t, err)
240 require.NotNil(t, resp.Metrics.InspectedBytes)
241 require.NotZero(t, resp.Metrics.InspectedBytes)
242 require.LessOrEqual(t, resp.Metrics.InspectedBytes, block.DataLength())
243
244 require.Equal(t, 1, len(resp.Traces))
245 require.Equal(t, util.TraceIDToHexString(ids[i]), resp.Traces[0].TraceID)
246 }
247 })
248}
249
250func TestFetch(t *testing.T) {
251 for _, e := range encoding.AllEncodingsForWrites() {

Callers 1

TestSearchFunction · 0.70

Calls 8

DefaultSearchOptionsFunction · 0.92
TraceIDToHexStringFunction · 0.92
runWALTestFunction · 0.85
findFirstAttributeFunction · 0.85
VersionMethod · 0.65
SearchMethod · 0.65
DataLengthMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected