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

Function TestParseQueryRequestInvalidBounds

pkg/api/http_test.go:720–753  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

718}
719
720func TestParseQueryRequestInvalidBounds(t *testing.T) {
721 tests := []struct {
722 name string
723 params map[string]string
724 errMsg string
725 }{
726 {
727 name: "invalid start",
728 params: map[string]string{"q": "{} | rate()", "start": "abc", "end": "1700000000"},
729 errMsg: "could not parse 'start' parameter",
730 },
731 {
732 name: "invalid end",
733 params: map[string]string{"q": "{} | rate()", "start": "1700000000", "end": "bca"},
734 errMsg: "could not parse 'end' parameter",
735 },
736 }
737
738 for _, tt := range tests {
739 t.Run("range/"+tt.name, func(t *testing.T) {
740 r := makeReq(tt.params)
741 _, err := ParseQueryRangeRequest(r)
742 require.Error(t, err)
743 assert.Contains(t, err.Error(), tt.errMsg)
744 })
745
746 t.Run("instant/"+tt.name, func(t *testing.T) {
747 r := makeReq(tt.params)
748 _, err := ParseQueryInstantRequest(r)
749 require.Error(t, err)
750 assert.Contains(t, err.Error(), tt.errMsg)
751 })
752 }
753}
754
755func TestQueryRangeRoundtripEmpty(t *testing.T) {
756 req := &tempopb.QueryRangeRequest{

Callers

nothing calls this directly

Calls 5

ParseQueryRangeRequestFunction · 0.85
ParseQueryInstantRequestFunction · 0.85
makeReqFunction · 0.70
ErrorMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected