Files
zitadel/internal/integration/rand.go
Stefan Benz 6e8aa9a7d1 chore: fix flakiness in gofakeit usage with additional random string (#10385)
# Which Problems Are Solved

Flakiness in integration tests regarding gofakeit functions, which
provided the same names on 2 different occasions.

# How the Problems Are Solved

Attach a random string to the provided names, so that they are not
dependent on the gofakeit code.

# Additional Changes

None

# Additional Context

None

---------

Co-authored-by: Marco A. <marco@zitadel.com>
2025-08-07 13:27:01 +00:00

21 lines
313 B
Go

package integration
import (
"math/rand"
"time"
)
func init() {
rand.NewSource(time.Now().UnixNano())
}
var letterRunes = []rune("abcdefghijklmnopqrstuvwxyz")
func RandString(n int) string {
b := make([]rune, n)
for i := range b {
b[i] = letterRunes[rand.Intn(len(letterRunes))]
}
return string(b)
}