forked from mirror/client_golang
Merge pull request #779 from johejo/fix_tests_string_type_conversions
fix tests warning about string(int) type conversions
This commit is contained in:
commit
d3accfda21
|
@ -139,7 +139,7 @@ func TestGaugeVecConcurrency(t *testing.T) {
|
|||
start.Wait()
|
||||
for i, v := range vals {
|
||||
sStreams[pick[i]] <- v
|
||||
gge.WithLabelValues(string('A' + pick[i])).Add(v)
|
||||
gge.WithLabelValues(string('A' + rune(pick[i]))).Add(v)
|
||||
}
|
||||
end.Done()
|
||||
}(vals)
|
||||
|
@ -147,7 +147,7 @@ func TestGaugeVecConcurrency(t *testing.T) {
|
|||
start.Done()
|
||||
|
||||
for i := range sStreams {
|
||||
if expected, got := <-results[i], math.Float64frombits(gge.WithLabelValues(string('A'+i)).(*gauge).valBits); math.Abs(expected-got) > 0.000001 {
|
||||
if expected, got := <-results[i], math.Float64frombits(gge.WithLabelValues(string('A'+rune(i))).(*gauge).valBits); math.Abs(expected-got) > 0.000001 {
|
||||
t.Fatalf("expected approx. %f, got %f", expected, got)
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -279,7 +279,7 @@ func TestHistogramVecConcurrency(t *testing.T) {
|
|||
go func(vals []float64) {
|
||||
start.Wait()
|
||||
for i, v := range vals {
|
||||
his.WithLabelValues(string('A' + picks[i])).Observe(v)
|
||||
his.WithLabelValues(string('A' + rune(picks[i]))).Observe(v)
|
||||
}
|
||||
end.Done()
|
||||
}(vals)
|
||||
|
@ -292,7 +292,7 @@ func TestHistogramVecConcurrency(t *testing.T) {
|
|||
|
||||
for i := 0; i < vecLength; i++ {
|
||||
m := &dto.Metric{}
|
||||
s := his.WithLabelValues(string('A' + i))
|
||||
s := his.WithLabelValues(string('A' + rune(i)))
|
||||
s.(Histogram).Write(m)
|
||||
|
||||
if got, want := len(m.Histogram.Bucket), len(testBuckets)-1; got != want {
|
||||
|
|
|
@ -321,7 +321,7 @@ func TestSummaryVecConcurrency(t *testing.T) {
|
|||
go func(vals []float64) {
|
||||
start.Wait()
|
||||
for i, v := range vals {
|
||||
sum.WithLabelValues(string('A' + picks[i])).Observe(v)
|
||||
sum.WithLabelValues(string('A' + rune(picks[i]))).Observe(v)
|
||||
}
|
||||
end.Done()
|
||||
}(vals)
|
||||
|
@ -334,7 +334,7 @@ func TestSummaryVecConcurrency(t *testing.T) {
|
|||
|
||||
for i := 0; i < vecLength; i++ {
|
||||
m := &dto.Metric{}
|
||||
s := sum.WithLabelValues(string('A' + i))
|
||||
s := sum.WithLabelValues(string('A' + rune(i)))
|
||||
s.(Summary).Write(m)
|
||||
if got, want := int(*m.Summary.SampleCount), len(allVars[i]); got != want {
|
||||
t.Errorf("got sample count %d for label %c, want %d", got, 'A'+i, want)
|
||||
|
|
Loading…
Reference in New Issue