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

Function TestSelectOperation

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

Source from the content-addressed store, hash-verified

546}
547
548func TestSelectOperation(t *testing.T) {
549 tests := []struct {
550 in string
551 expected Pipeline
552 expectedStr string
553 }{
554 {in: "select(.a)", expected: newPipeline(newSelectOperation([]Attribute{NewAttribute("a")})), expectedStr: "select(.a)"},
555 {in: "select(.a,.b)", expected: newPipeline(newSelectOperation([]Attribute{NewAttribute("a"), NewAttribute("b")})), expectedStr: "select(.a, .b)"},
556 }
557
558 for _, tc := range tests {
559 t.Run(tc.in, func(t *testing.T) {
560 actual, err := Parse(tc.in)
561
562 require.NoError(t, err)
563 require.Equal(t, newRootExpr(tc.expected), actual)
564 require.Equal(t, tc.expectedStr, actual.String())
565 })
566 }
567}
568
569func TestSpansetExpressionErrors(t *testing.T) {
570 tests := []struct {

Callers

nothing calls this directly

Calls 8

newPipelineFunction · 0.85
newSelectOperationFunction · 0.85
NewAttributeFunction · 0.85
ParseFunction · 0.85
newRootExprFunction · 0.85
RunMethod · 0.45
EqualMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected