(t *testing.T)
| 1539 | } |
| 1540 | |
| 1541 | func 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 | |
| 1580 | func TestReallyLongQuery(t *testing.T) { |
| 1581 | for i := 1000; i < 1050; i++ { |
nothing calls this directly
no test coverage detected