Skip to content

Commit

Permalink
Re-add len parameter to RNG
Browse files Browse the repository at this point in the history
  • Loading branch information
barchw committed Dec 2, 2024
1 parent 011ab84 commit 34b70fc
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/integration/pkg/global/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
const globalCommonsFileName = "global-commons.yaml"

func GenerateNamespaceName(testsuiteName string) string {
return fmt.Sprintf("%s-%s", testsuiteName, helpers.GenerateRandomString())
return fmt.Sprintf("%s-%s", testsuiteName, helpers.GenerateRandomString(6))
}

func getGlobalResources(resourceMgr *resource.Manager, k8sClient dynamic.Interface, namespace string, manifestsDir string) ([]unstructured.Unstructured, error) {
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/pkg/helpers/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ import (
)

func GenerateRandomTestId() string {
return GenerateRandomString()
return GenerateRandomString(8)
}

var (
r = rand.New(rand.NewSource(time.Now().UnixNano()))
rMutex = &sync.Mutex{}
)

func GenerateRandomString() string {
func GenerateRandomString(length int) string {
letterRunes := []rune("abcdefghijklmnopqrstuvwxyz")

b := make([]rune, 10)
b := make([]rune, length)

rMutex.Lock()
for i := range b {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/testsuites/custom-domain/scenario.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func (c *scenario) isDNSReady() error {
Factor: 2,
Steps: 10,
}, func() (done bool, err error) {
testName := helpers.GenerateRandomString()
testName := helpers.GenerateRandomString(3)
ips, err := net.LookupIP(fmt.Sprintf("%s.%s.%s", testName, c.testID, c.domain))
if err != nil {
return false, nil
Expand Down
1 change: 0 additions & 1 deletion tests/integration/testsuites/v2alpha1/testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ type testsuite struct {
config testcontext.Config
oauth2Cfg *clientcredentials.Config
jwtConfig *clientcredentials.Config
failed bool
}

func (t *testsuite) InitScenarios(ctx *godog.ScenarioContext) {
Expand Down

0 comments on commit 34b70fc

Please sign in to comment.