Use randfill, do API renames

Kubernetes-commit: e54719bb6674fac228671e0786d19c2cf27b08a3
This commit is contained in:
Tim Hockin
2025-02-20 09:45:22 -08:00
committed by Kubernetes Publisher
parent b3c8744140
commit 4a6072d89f
3 changed files with 68 additions and 68 deletions

View File

@@ -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.