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

Function TestGroupCoalesceOperation

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

Source from the content-addressed store, hash-verified

507}
508
509func TestGroupCoalesceOperation(t *testing.T) {
510 tests := []struct {
511 in string
512 expected Pipeline
513 expectedStr string
514 }{
515 {in: "by(.a) | coalesce()", expected: newPipeline(newGroupOperation(NewAttribute("a")), newCoalesceOperation()), expectedStr: "by(.a)|coalesce()"},
516 {in: "by(.a + .b)", expected: newPipeline(newGroupOperation(newBinaryOperation(OpAdd, NewAttribute("a"), NewAttribute("b")))), expectedStr: "by(.a + .b)"},
517 }
518
519 for _, tc := range tests {
520 t.Run(tc.in, func(t *testing.T) {
521 actual, err := Parse(tc.in)
522
523 require.NoError(t, err)
524 require.Equal(t, newRootExpr(tc.expected), actual)
525 require.Equal(t, tc.expectedStr, actual.String())
526 })
527 }
528}
529
530func TestSelectErrors(t *testing.T) {
531 tests := []struct {

Callers

nothing calls this directly

Calls 10

newPipelineFunction · 0.85
newGroupOperationFunction · 0.85
NewAttributeFunction · 0.85
newCoalesceOperationFunction · 0.85
newBinaryOperationFunction · 0.85
ParseFunction · 0.85
newRootExprFunction · 0.85
RunMethod · 0.45
EqualMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected