-
-
Notifications
You must be signed in to change notification settings - Fork 230
remote-feature-flag-controller: Fix flaky test #5730
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
Conversation
The test for `generateDeterministicRandomNumber` sometimes fails because it relies on the behavior of `uuidv4`, which is non-deterministic, and needs to be more lenient in the range of acceptable return values.
I've ran this test locally a few times and didn't get a failure, so I feel like this should help things. |
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
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.
Looks like a reasonable fix for flakiness.
const expectedPerRange = samples / ranges.length; | ||
const allowedDeviation = expectedPerRange * 0.3; | ||
const allowedDeviation = expectedPerRange * 0.4; |
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.
Is 40% a safe range for the test's requirements? It seems like this might relax the test into validating a very-roughly uniform distribution.😅
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.
That's a great question. I'm not sure 😅 It seems like the range of values is wider than we expect. It also seems that if generateDeterministicRandomNumber
is supposed to be deterministic, we don't have to use random UUIDs or user IDs in the test, we can use known values. But I assume that there is a specific reason we wrote the test this way and fixing it further seemed out of scope.
LGTM. ! |
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!
Explanation
The test for
generateDeterministicRandomNumber
sometimes fails because it relies on the behavior ofuuidv4
, which is non-deterministic, and needs to be more lenient in the range of acceptable return values.References
Changelog
Checklist