From 5f340e6b743d3b1741954313f2e5cdd7b74a19bf Mon Sep 17 00:00:00 2001 From: vittoria salim Date: Fri, 5 Sep 2025 09:58:19 +1000 Subject: [PATCH 1/2] fix(patch): unified condition keep name as it is when size <=0 --- request/random.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/request/random.go b/request/random.go index 32012e0..ed6894d 100644 --- a/request/random.go +++ b/request/random.go @@ -405,12 +405,13 @@ func (b *requestPatchBuilder) Build(cli rest.Interface) Requester { if b.namespace != "" { comps = append(comps, "namespaces", b.namespace) } - // Generate random suffix based on keySpaceSize - randomInt, _ := rand.Int(rand.Reader, big.NewInt(int64(b.keySpaceSize))) - suffix := randomInt.Int64() - - // Create final resource name: name-{suffix} - finalName := fmt.Sprintf("%s-%d", b.name, suffix) + + finalName := b.name + + if b.keySpaceSize > 0 { + randomInt, _ := rand.Int(rand.Reader, big.NewInt(int64(b.keySpaceSize))) + finalName = fmt.Sprintf("%s-%d", b.name, randomInt.Int64()) + } comps = append(comps, b.resource, finalName) return &DiscardRequester{ From 9f0c7589a1e6a8a82ff4b4f4f76d8b47655ad5d5 Mon Sep 17 00:00:00 2001 From: vittoria salim Date: Fri, 5 Sep 2025 10:04:38 +1000 Subject: [PATCH 2/2] fix(patch): fix linter --- request/random.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/request/random.go b/request/random.go index ed6894d..d8f5191 100644 --- a/request/random.go +++ b/request/random.go @@ -405,9 +405,9 @@ func (b *requestPatchBuilder) Build(cli rest.Interface) Requester { if b.namespace != "" { comps = append(comps, "namespaces", b.namespace) } - + finalName := b.name - + if b.keySpaceSize > 0 { randomInt, _ := rand.Int(rand.Reader, big.NewInt(int64(b.keySpaceSize))) finalName = fmt.Sprintf("%s-%d", b.name, randomInt.Int64())