-
Notifications
You must be signed in to change notification settings - Fork 177
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
Write TestRandom util #976
Conversation
Signed-off-by: litt3 <[email protected]>
Signed-off-by: litt3 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly LGTM, but have a few nits
Signed-off-by: litt3 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
// GetRand returns the underlying random instance | ||
func (r *TestRandom) GetRand() *rand.Rand { | ||
return r.Rand | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: getter is not needed with a public field
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signed-off-by: litt3 <[email protected]>
Why are these changes needed?
common/testutils/test_utils.go
operate by seeding global rand. This isn't ideal, as it doesn't provide a source of randomness that can be passed into objects during testing.test_utils.go
, but with a non-global instance of random.Checks