Merge pull request #15903 from prometheus/beorn7/promql2

promqltest: Small formatting improvement for native histograms
pull/15860/head^2
Björn Rabenstein 11 months ago committed by GitHub
commit 3389cdf957
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      promql/promqltest/test.go
  2. 2
      promql/promqltest/test_test.go

@ -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…
Cancel
Save