Skip to content

Commit d2ce3e9

Browse files
author
vittoria salim
committed
unified condition
1 parent d890869 commit d2ce3e9

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

request/random.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -414,12 +414,11 @@ func (b *requestPatchBuilder) Build(cli rest.Interface) Requester {
414414
comps = append(comps, "namespaces", b.namespace)
415415
}
416416

417-
// Generate random suffix based on keySpaceSize
418-
randomInt, _ := rand.Int(rand.Reader, big.NewInt(int64(b.keySpaceSize)))
419-
suffix := randomInt.Int64()
420-
421-
// Create final resource name: name-{suffix}
422-
finalName := fmt.Sprintf("%s-%d", b.name, suffix)
417+
finalName := b.name
418+
if b.keySpaceSize > 0 {
419+
randomInt, _ := rand.Int(rand.Reader, big.NewInt(int64(b.keySpaceSize)))
420+
finalName = fmt.Sprintf("%s-%d", b.name, randomInt.Int64())
421+
}
423422
comps = append(comps, b.resource, finalName)
424423

425424
return &DiscardRequester{

0 commit comments

Comments
 (0)