Skip to content

Commit 3389cdf

Browse files
authored
Merge pull request prometheus#15903 from prometheus/beorn7/promql2
promqltest: Small formatting improvement for native histograms
2 parents a8235d5 + 9f6c1d9 commit 3389cdf

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

promql/promqltest/test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ func (ev *evalCmd) compareResult(result parser.Value) error {
800800
fp := v.Metric.Hash()
801801
if _, ok := ev.metrics[fp]; !ok {
802802
if v.H != nil {
803-
return fmt.Errorf("unexpected metric %s in result, has value %v", v.Metric, v.H)
803+
return fmt.Errorf("unexpected metric %s in result, has value %s", v.Metric, HistogramTestExpression(v.H))
804804
}
805805

806806
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 {
838838
}
839839
exp0 := ev.expected[0].vals[0]
840840
if exp0.Histogram != nil {
841-
return fmt.Errorf("expected histogram %v but got %s", exp0.Histogram.TestExpression(), val.String())
841+
return fmt.Errorf("expected histogram %s but got %s", exp0.Histogram.TestExpression(), val.String())
842842
}
843843
if !almost.Equal(exp0.Value, val.V, defaultEpsilon) {
844844
return fmt.Errorf("expected scalar %v but got %v", exp0.Value, val.V)

promql/promqltest/test_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ load 5m
247247
248248
eval instant at 0m testmetric
249249
`,
250-
expectedError: `error in eval testmetric (line 5): unexpected metric {__name__="testmetric"} in result, has value {count:0, sum:0}`,
250+
expectedError: `error in eval testmetric (line 5): unexpected metric {__name__="testmetric"} in result, has value {{}}`,
251251
},
252252
"instant query, but result is missing a series": {
253253
input: testData + `

0 commit comments

Comments
 (0)