forked from mirror/client_golang
Improve testutil error messages
This also satisfy newer staticcheck versions. Signed-off-by: beorn7 <beorn@soundcloud.com>
This commit is contained in:
parent
91b385db44
commit
b3d6096432
|
@ -165,11 +165,9 @@ func compare(got, want []*dto.MetricFamily) error {
|
||||||
metric output does not match expectation; want:
|
metric output does not match expectation; want:
|
||||||
|
|
||||||
%s
|
%s
|
||||||
|
|
||||||
got:
|
got:
|
||||||
|
|
||||||
%s
|
%s`, wantBuf.String(), gotBuf.String())
|
||||||
`, wantBuf.String(), gotBuf.String())
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -171,7 +171,6 @@ func TestCollectAndCompareHistogram(t *testing.T) {
|
||||||
c prometheus.Collector
|
c prometheus.Collector
|
||||||
metadata string
|
metadata string
|
||||||
expect string
|
expect string
|
||||||
labels []string
|
|
||||||
observation float64
|
observation float64
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
|
@ -291,13 +290,11 @@ metric output does not match expectation; want:
|
||||||
# TYPE some_other_metric counter
|
# TYPE some_other_metric counter
|
||||||
some_other_metric{label1="value1"} 1.0
|
some_other_metric{label1="value1"} 1.0
|
||||||
|
|
||||||
|
|
||||||
got:
|
got:
|
||||||
|
|
||||||
# HELP some_total A value that represents a counter.
|
# HELP some_total A value that represents a counter.
|
||||||
# TYPE some_total counter
|
# TYPE some_total counter
|
||||||
some_total{label1="value1"} 1.0
|
some_total{label1="value1"} 1.0
|
||||||
|
|
||||||
`
|
`
|
||||||
|
|
||||||
err := CollectAndCompare(c, strings.NewReader(metadata+expected))
|
err := CollectAndCompare(c, strings.NewReader(metadata+expected))
|
||||||
|
@ -306,6 +303,6 @@ some_total{label1="value1"} 1.0
|
||||||
}
|
}
|
||||||
|
|
||||||
if err.Error() != expectedError {
|
if err.Error() != expectedError {
|
||||||
t.Errorf("Expected\n%#+v\nGot:\n%#+v\n", expectedError, err.Error())
|
t.Errorf("Expected\n%#+v\nGot:\n%#+v", expectedError, err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue