mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 03:03:59 +00:00
Merge pull request #121913 from liggitt/testing-dep
Drop testing dependency from shipped binaries
This commit is contained in:
commit
30bb24b1c3
@ -22,7 +22,6 @@ import (
|
||||
"net/url"
|
||||
"reflect"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
@ -33,6 +32,10 @@ import (
|
||||
"k8s.io/kubernetes/pkg/volume"
|
||||
)
|
||||
|
||||
type TB interface {
|
||||
Errorf(format string, args ...any)
|
||||
}
|
||||
|
||||
type FakePod struct {
|
||||
Pod *kubecontainer.Pod
|
||||
NetnsPath string
|
||||
@ -65,7 +68,7 @@ type FakeRuntime struct {
|
||||
// from container runtime.
|
||||
BlockImagePulls bool
|
||||
imagePullTokenBucket chan bool
|
||||
T *testing.T
|
||||
T TB
|
||||
}
|
||||
|
||||
const FakeHost = "localhost:12345"
|
||||
|
@ -19,7 +19,6 @@ package testutil
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus/testutil"
|
||||
|
||||
@ -28,6 +27,12 @@ import (
|
||||
"k8s.io/component-base/metrics/legacyregistry"
|
||||
)
|
||||
|
||||
type TB interface {
|
||||
Logf(format string, args ...any)
|
||||
Errorf(format string, args ...any)
|
||||
Fatalf(format string, args ...any)
|
||||
}
|
||||
|
||||
// CollectAndCompare registers the provided Collector with a newly created
|
||||
// pedantic Registry. It then does the same as GatherAndCompare, gathering the
|
||||
// metrics from the pedantic Registry.
|
||||
@ -94,7 +99,7 @@ func NewFakeKubeRegistry(ver string) metrics.KubeRegistry {
|
||||
return metrics.NewKubeRegistry()
|
||||
}
|
||||
|
||||
func AssertVectorCount(t *testing.T, name string, labelFilter map[string]string, wantCount int) {
|
||||
func AssertVectorCount(t TB, name string, labelFilter map[string]string, wantCount int) {
|
||||
metrics, err := legacyregistry.DefaultGatherer.Gather()
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to gather metrics: %s", err)
|
||||
@ -124,7 +129,7 @@ func AssertVectorCount(t *testing.T, name string, labelFilter map[string]string,
|
||||
}
|
||||
}
|
||||
|
||||
func AssertHistogramTotalCount(t *testing.T, name string, labelFilter map[string]string, wantCount int) {
|
||||
func AssertHistogramTotalCount(t TB, name string, labelFilter map[string]string, wantCount int) {
|
||||
metrics, err := legacyregistry.DefaultGatherer.Gather()
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to gather metrics: %s", err)
|
||||
|
Loading…
Reference in New Issue
Block a user