Skip to content

Commit

Permalink
test(tempoe2e): add autocomplete query test
Browse files Browse the repository at this point in the history
  • Loading branch information
tdakkota committed Jun 14, 2024
1 parent 2dde5ad commit 3fb15ba
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion integration/tempoe2e/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ func setupDB(
if engineQuerier != nil {
engine = traceqlengine.NewEngine(engineQuerier, traceqlengine.Options{})
}
api := tempohandler.NewTempoAPI(querier, engine, tempohandler.TempoAPIOptions{})
api := tempohandler.NewTempoAPI(querier, engine, tempohandler.TempoAPIOptions{
EnableAutocompleteQuery: true,
})
tempoh, err := tempoapi.NewServer(api)
require.NoError(t, err)

Expand Down Expand Up @@ -351,6 +353,18 @@ func runTest(
maps.Keys(set.SpanNames),
false,
},
{
"SpanNameWithQuery",
tempoapi.SearchTagValuesV2Params{
AttributeSelector: `name`,
Start: start,
End: end,
Q: tempoapi.NewOptString(`{ name = "authenticate" && .service.name = }`),
},
"string",
[]string{"authenticate"},
false,
},
{
"SpanStatus",
tempoapi.SearchTagValuesV2Params{
Expand Down Expand Up @@ -406,6 +420,32 @@ func runTest(
maps.Keys(set.RootSpanNames),
false,
},
{
"RootSpanNameWithQuery",
tempoapi.SearchTagValuesV2Params{
AttributeSelector: `rootName`,
Start: start,
End: end,
Q: tempoapi.NewOptString(`{ name = "list-articles" }`),
},
"string",
[]string{"list-articles"},
false,
},
{
// Ensure that `rootName` would return nothing if we query a
// non-root span.
"RootSpanNameNoMatch",
tempoapi.SearchTagValuesV2Params{
AttributeSelector: `rootName`,
Start: start,
End: end,
Q: tempoapi.NewOptString(`{ name = "authenticate" }`),
},
"string",
nil,
false,
},
{
"RootServiceName",
tempoapi.SearchTagValuesV2Params{
Expand Down

0 comments on commit 3fb15ba

Please sign in to comment.