Remove direct reference to prometheus from apiserver/pkg/storage/value.

This commit is contained in:
RainbowMango
2019-10-09 21:58:51 +08:00
parent 2e55cf01d1
commit 78d0f1827a
2 changed files with 7 additions and 7 deletions

View File

@@ -24,8 +24,8 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/testutil"
"k8s.io/component-base/metrics/legacyregistry"
"k8s.io/component-base/metrics/testutil"
)
func TestTotals(t *testing.T) {
@@ -122,7 +122,7 @@ apiserver_storage_transformation_operations_total{status="Internal",transformati
tt.prefix.TransformFromStorage([]byte("k8s:enc:kms:v1:value"), nil)
defer transformerOperationsTotal.Reset()
defer deprecatedTransformerFailuresTotal.Reset()
if err := testutil.GatherAndCompare(prometheus.DefaultGatherer, strings.NewReader(tt.want), tt.metrics...); err != nil {
if err := testutil.GatherAndCompare(legacyregistry.DefaultGatherer, strings.NewReader(tt.want), tt.metrics...); err != nil {
t.Fatal(err)
}
})

View File

@@ -22,8 +22,8 @@ import (
"strings"
"testing"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/testutil"
"k8s.io/component-base/metrics/legacyregistry"
"k8s.io/component-base/metrics/testutil"
)
type testTransformer struct {
@@ -185,7 +185,7 @@ func TestPrefixFromMetrics(t *testing.T) {
t.Run(tc.desc, func(t *testing.T) {
tc.prefix.TransformFromStorage(tc.input, nil)
defer transformerOperationsTotal.Reset()
if err := testutil.GatherAndCompare(prometheus.DefaultGatherer, strings.NewReader(tc.want), tc.metrics...); err != nil {
if err := testutil.GatherAndCompare(legacyregistry.DefaultGatherer, strings.NewReader(tc.want), tc.metrics...); err != nil {
t.Fatal(err)
}
})
@@ -243,7 +243,7 @@ func TestPrefixToMetrics(t *testing.T) {
t.Run(tc.desc, func(t *testing.T) {
tc.prefix.TransformToStorage(tc.input, nil)
defer transformerOperationsTotal.Reset()
if err := testutil.GatherAndCompare(prometheus.DefaultGatherer, strings.NewReader(tc.want), tc.metrics...); err != nil {
if err := testutil.GatherAndCompare(legacyregistry.DefaultGatherer, strings.NewReader(tc.want), tc.metrics...); err != nil {
t.Fatal(err)
}
})