diff --git a/prometheus/gauge_test.go b/prometheus/gauge_test.go index a2e3c14..b70da7d 100644 --- a/prometheus/gauge_test.go +++ b/prometheus/gauge_test.go @@ -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 } diff --git a/prometheus/histogram_test.go b/prometheus/histogram_test.go index 0b4826c..e779c1a 100644 --- a/prometheus/histogram_test.go +++ b/prometheus/histogram_test.go @@ -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 { diff --git a/prometheus/summary_test.go b/prometheus/summary_test.go index 43b8396..eff733a 100644 --- a/prometheus/summary_test.go +++ b/prometheus/summary_test.go @@ -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)