expectedError:`error in eval testmetric (line 5): expected {{schema:-1count:1sum:6offset:1buckets:[1]}} for {__name__="testmetric"} but got {{schema:-1count:1sum:4offset:1buckets:[1]}}`,
},
"instant query with float value returned when histogram expected":{
input:`
load5m
testmetric2
evalinstantat0testmetric
testmetric{{}}
`,
expectedError:`error in eval testmetric (line 5): expected histogram {{}} for {__name__="testmetric"} but got float value 2`,
},
"instant query with histogram returned when float expected":{
input:`
load5m
testmetric{{}}
evalinstantat0testmetric
testmetric2
`,
expectedError:`error in eval testmetric (line 5): expected float value 2.000000 for {__name__="testmetric"} but got histogram {{}}`,
expectedError:`error in eval sort(http_requests) (line 8): expected metric {__name__="http_requests", group="canary", instance="0", job="api-server"} with [300.000000] at position 4 but was at 3`,
},
"instant query with results expected to match provided order, but result has an unexpected series":{
expectedError:`error in eval sort(http_requests) (line 8): unexpected metric {__name__="http_requests", group="canary", instance="1", job="api-server"} in result, has value 400`,
expectedError:`error in eval sum by (group) (http_requests) (line 8): expected float value at index 1 (t=300000) for {group="canary"} to be 80, but got 70 (result has 3 float points [0 @[0] 70 @[300000] 140 @[600000]] and 0 histogram points [])`,
expectedError:`error in eval testmetric (line 5): expected histogram value at index 1 (t=300000) for {__name__="testmetric"} to be {count:1, sum:7, (1,4]:1}, but got {count:1, sum:5, (1,4]:1} (result has 0 float points [] and 3 histogram points [{count:1, sum:4, (1,4]:1} @[0] {count:1, sum:5, (1,4]:1} @[300000] {count:1, sum:6, (1,4]:1} @[600000]])`,
},
"range query with too many points for query time range":{
expectedError:`error in eval sum by (group) (http_requests) (line 8): expected 4 points for {group="production"}, but query time range cannot return this many points`,
},
"range query with missing point in result":{
input:`
load5m
testmetric5
evalrangefrom0to6mstep6mtestmetric
testmetric510
`,
expectedError:`error in eval testmetric (line 5): expected 2 float points and 0 histogram points for {__name__="testmetric"}, but got 1 float point [5 @[0]] and 0 histogram points []`,
expectedError:`error in eval sum by (group) (http_requests) (line 8): expected 2 float points and 0 histogram points for {group="production"}, but got 3 float points [0 @[0] 30 @[300000] 60 @[600000]] and 0 histogram points []`,
},
"range query, but result has an unexpected series":{
expectedError:`error in eval sum by (group) (http_requests) (line 8): unexpected metric {group="canary"} in result, has 3 float points [0 @[0] 70 @[300000] 140 @[600000]] and 0 histogram points []`,
"range query expected to fail, but query succeeds":{
input:`eval_fail range from 0 to 10m step 5m vector(0)`,
expectedError:`expected error evaluating query "vector(0)" (line 1) but got none`,
},
"range query with from and to timestamps in wrong order":{
input:`eval range from 10m to 9m step 5m vector(0)`,
expectedError:`error in eval vector(0) (line 1): invalid test definition, end timestamp (9m) is before start timestamp (10m)`,
},
"range query with sparse output":{
input:`
load6m
testmetric1_3
evalrangefrom0to18mstep6mtestmetric
testmetric1_3
`,
},
"range query with float value returned when no value expected":{
input:`
load6m
testmetric123
evalrangefrom0to18mstep6mtestmetric
testmetric1_3
`,
expectedError:`error in eval testmetric (line 5): expected 2 float points and 0 histogram points for {__name__="testmetric"}, but got 3 float points [1 @[0] 2 @[360000] 3 @[720000]] and 0 histogram points []`,
},
"range query with float value returned when histogram expected":{
input:`
load5m
testmetric23
evalrangefrom0to5mstep5mtestmetric
testmetric{{}}{{}}
`,
expectedError:`error in eval testmetric (line 5): expected 0 float points and 2 histogram points for {__name__="testmetric"}, but got 2 float points [2 @[0] 3 @[300000]] and 0 histogram points []`,
},
"range query with histogram returned when float expected":{
input:`
load5m
testmetric{{}}{{}}
evalrangefrom0to5mstep5mtestmetric
testmetric23
`,
expectedError:`error in eval testmetric (line 5): expected 2 float points and 0 histogram points for {__name__="testmetric"}, but got 0 float points [] and 2 histogram points [{count:0, sum:0} @[0] {count:0, sum:0} @[300000]]`,
},
"range query with expected mixed results":{
input:`
load6m
testmetric{group="a"}{{}}__
testmetric{group="b"}__3
evalrangefrom0to12mstep6msum(testmetric)
{}{{}}_3
`,
},
"range query with mixed results and incorrect values":{
input:`
load5m
testmetric3{{}}
evalrangefrom0to5mstep5mtestmetric
testmetric{{}}3
`,
expectedError:`error in eval testmetric (line 5): expected float value at index 0 for {__name__="testmetric"} to have timestamp 300000, but it had timestamp 0 (result has 1 float point [3 @[0]] and 1 histogram point [{count:0, sum:0} @[300000]])`,
expectedError:`matrix results should always be sorted by labels, but matrix is not sorted: series at index 1 with labels {the_label="value_1"} sorts before series at index 0 with labels {the_label="value_2"}`,
},
"matrix with three series, series in sorted order":{
expectedError:`matrix results should always be sorted by labels, but matrix is not sorted: series at index 2 with labels {the_label="value_2"} sorts before series at index 1 with labels {the_label="value_3"}`,