mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-05 17:10:27 +00:00
Use randfill, do API renames
Kubernetes-commit: e54719bb6674fac228671e0786d19c2cf27b08a3
This commit is contained in:
committed by
Kubernetes Publisher
parent
b3c8744140
commit
4a6072d89f
8
tools/cache/controller_test.go
vendored
8
tools/cache/controller_test.go
vendored
@@ -35,7 +35,7 @@ import (
|
||||
fcache "k8s.io/client-go/tools/cache/testing"
|
||||
"k8s.io/klog/v2/ktesting"
|
||||
|
||||
fuzz "github.com/google/gofuzz"
|
||||
"sigs.k8s.io/randfill"
|
||||
)
|
||||
|
||||
func Example() {
|
||||
@@ -252,12 +252,12 @@ func TestHammerController(t *testing.T) {
|
||||
// Let's add a few objects to the source.
|
||||
currentNames := sets.String{}
|
||||
rs := rand.NewSource(rand.Int63())
|
||||
f := fuzz.New().NilChance(.5).NumElements(0, 2).RandSource(rs)
|
||||
f := randfill.New().NilChance(.5).NumElements(0, 2).RandSource(rs)
|
||||
for i := 0; i < 100; i++ {
|
||||
var name string
|
||||
var isNew bool
|
||||
if currentNames.Len() == 0 || rand.Intn(3) == 1 {
|
||||
f.Fuzz(&name)
|
||||
f.Fill(&name)
|
||||
isNew = true
|
||||
} else {
|
||||
l := currentNames.List()
|
||||
@@ -265,7 +265,7 @@ func TestHammerController(t *testing.T) {
|
||||
}
|
||||
|
||||
pod := &v1.Pod{}
|
||||
f.Fuzz(pod)
|
||||
f.Fill(pod)
|
||||
pod.ObjectMeta.Name = name
|
||||
pod.ObjectMeta.Namespace = "default"
|
||||
// Add, update, or delete randomly.
|
||||
|
Reference in New Issue
Block a user