Skip to content

Commit

Permalink
Add test for vector type as well
Browse files Browse the repository at this point in the history
Signed-off-by: Kaviraj <[email protected]>
  • Loading branch information
kavirajk committed Oct 12, 2021
1 parent e0ad96a commit dad1106
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions pkg/querier/queryrange/codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,21 @@ func Test_codec_DecodeResponse(t *testing.T) {
Statistics: statsResult,
}, false,
},
{
"vector-empty-streams",
&http.Response{StatusCode: 200, Body: ioutil.NopCloser(strings.NewReader(vectorStringEmptyResult))},
nil,
&LokiPromResponse{
Response: &queryrange.PrometheusResponse{
Status: loghttp.QueryStatusSuccess,
Data: queryrange.PrometheusData{
ResultType: loghttp.ResultTypeVector,
Result: make([]queryrange.SampleStream, 0), // shouldn't be nil.
},
},
Statistics: statsResult,
}, false,
},
{
"streams v1", &http.Response{StatusCode: 200, Body: ioutil.NopCloser(strings.NewReader(streamsString))},
&LokiRequest{Direction: logproto.FORWARD, Limit: 100, Path: "/loki/api/v1/query_range"},
Expand Down Expand Up @@ -928,6 +943,15 @@ var (
},
"status": "success"
}`
vectorStringEmptyResult = `{
"data": {
` + statsResultString + `
"resultType": "vector",
"result": []
},
"status": "success"
}`

sampleStreams = []queryrange.SampleStream{
{
Labels: []cortexpb.LabelAdapter{{Name: "filename", Value: "/var/hostlog/apport.log"}, {Name: "job", Value: "varlogs"}},
Expand Down

0 comments on commit dad1106

Please sign in to comment.