Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace the random char seed to global rand to avoid collision #1729

Merged

Conversation

git-hulk
Copy link
Member

@git-hulk git-hulk commented Sep 3, 2023

#1727 changed the random string causing namespaces test fails.

This fixes #1728

mapleFU
mapleFU previously approved these changes Sep 3, 2023
Copy link
Member

@mapleFU mapleFU left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha, so thats GetCurrentTime collision to many times...

I'll write a GetUUID64 instead. Lets check this in first

@mapleFU
Copy link
Member

mapleFU commented Sep 3, 2023

func RandString(min, max int, typ RandStringType) string {
	return RandStringWithSeed(min, max, typ, rand.Int63())
}

The change LGTM, however, would it better to change RandString as above? Since WithSeed should better have a stable output with the same seed.

@git-hulk
Copy link
Member Author

git-hulk commented Sep 3, 2023

func RandString(min, max int, typ RandStringType) string {
	return RandStringWithSeed(min, max, typ, rand.Int63())
}

The change LGTM, however, would it better to change RandString as above? Since WithSeed should better have a stable output with the same seed.

I changed the seed to rand.Int63. It's better than the time seed.

mapleFU
mapleFU previously approved these changes Sep 3, 2023
enjoy-binbin
enjoy-binbin previously approved these changes Sep 3, 2023
tests/gocase/util/random.go Outdated Show resolved Hide resolved
tests/gocase/util/random.go Outdated Show resolved Hide resolved
@git-hulk git-hulk dismissed stale reviews from enjoy-binbin and mapleFU via 9d420df September 3, 2023 08:00
@enjoy-binbin enjoy-binbin merged commit 0049249 into apache:unstable Sep 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Large amount of failure of TestNamespace/Concurrent_creating_namespaces in CI
3 participants