mirror of https://github.com/prometheus/prometheus
promqltest: Small formatting improvement for native histograms
A `HistogramTestExpression` was missed in one case, which made the formatting weird in case a histogram got unexpectedly returned. Signed-off-by: beorn7 <beorn@grafana.com>pull/15903/head
parent
a8235d5dfd
commit
9f6c1d9cd3
|
@ -800,7 +800,7 @@ func (ev *evalCmd) compareResult(result parser.Value) error {
|
|||
fp := v.Metric.Hash()
|
||||
if _, ok := ev.metrics[fp]; !ok {
|
||||
if v.H != nil {
|
||||
return fmt.Errorf("unexpected metric %s in result, has value %v", v.Metric, v.H)
|
||||
return fmt.Errorf("unexpected metric %s in result, has value %s", v.Metric, HistogramTestExpression(v.H))
|
||||
}
|
||||
|
||||
return fmt.Errorf("unexpected metric %s in result, has value %v", v.Metric, v.F)
|
||||
|
@ -838,7 +838,7 @@ func (ev *evalCmd) compareResult(result parser.Value) error {
|
|||
}
|
||||
exp0 := ev.expected[0].vals[0]
|
||||
if exp0.Histogram != nil {
|
||||
return fmt.Errorf("expected histogram %v but got %s", exp0.Histogram.TestExpression(), val.String())
|
||||
return fmt.Errorf("expected histogram %s but got %s", exp0.Histogram.TestExpression(), val.String())
|
||||
}
|
||||
if !almost.Equal(exp0.Value, val.V, defaultEpsilon) {
|
||||
return fmt.Errorf("expected scalar %v but got %v", exp0.Value, val.V)
|
||||
|
|
|
@ -247,7 +247,7 @@ load 5m
|
|||
|
||||
eval instant at 0m testmetric
|
||||
`,
|
||||
expectedError: `error in eval testmetric (line 5): unexpected metric {__name__="testmetric"} in result, has value {count:0, sum:0}`,
|
||||
expectedError: `error in eval testmetric (line 5): unexpected metric {__name__="testmetric"} in result, has value {{}}`,
|
||||
},
|
||||
"instant query, but result is missing a series": {
|
||||
input: testData + `
|
||||
|
|
Loading…
Reference in New Issue