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

Function TestHints

pkg/traceql/parse_test.go:1541–1578  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1539}
1540
1541func TestHints(t *testing.T) {
1542 tests := []struct {
1543 in string
1544 expected *RootExpr
1545 expectedStr string
1546 }{
1547 {
1548 in: `{ } | rate() with(foo="bar")`,
1549 expected: newRootExprWithMetrics(
1550 newPipeline(newSpansetFilter(NewStaticBool(true))),
1551 newMetricsAggregate(metricsAggregateRate, nil),
1552 ).withHints(newHints([]*Hint{
1553 newHint("foo", NewStaticString("bar")),
1554 })),
1555 expectedStr: "{ true } | rate() with(foo=`bar`)",
1556 },
1557 {
1558 in: `{ } | rate() with(foo=0.5)`,
1559 expected: newRootExprWithMetrics(
1560 newPipeline(newSpansetFilter(NewStaticBool(true))),
1561 newMetricsAggregate(metricsAggregateRate, nil),
1562 ).withHints(newHints([]*Hint{
1563 newHint("foo", NewStaticFloat(0.5)),
1564 })),
1565 expectedStr: "{ true } | rate() with(foo=0.5)",
1566 },
1567 }
1568
1569 for _, tc := range tests {
1570 t.Run(tc.in, func(t *testing.T) {
1571 actual, err := Parse(tc.in)
1572
1573 require.NoError(t, err)
1574 require.Equal(t, tc.expected, actual)
1575 require.Equal(t, tc.expectedStr, actual.String())
1576 })
1577 }
1578}
1579
1580func TestReallyLongQuery(t *testing.T) {
1581 for i := 1000; i < 1050; i++ {

Callers

nothing calls this directly

Calls 14

newRootExprWithMetricsFunction · 0.85
newPipelineFunction · 0.85
newSpansetFilterFunction · 0.85
NewStaticBoolFunction · 0.85
newMetricsAggregateFunction · 0.85
newHintsFunction · 0.85
newHintFunction · 0.85
NewStaticStringFunction · 0.85
NewStaticFloatFunction · 0.85
ParseFunction · 0.85
withHintsMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected