-
Notifications
You must be signed in to change notification settings - Fork 90
OSSM-2109 Fix flaky IOR unit test #645
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 sleep in ensureNamespaceExists was hardcoded to 100ms, regardless of r.handleEventTimeout. This timeout during unit tests is only 1ms, so the 100ms sleep caused the for loop to only run once. Here we change the duration of the sleep to be 1/100 of r.handleEventTimeout. This change preserves the production sleep time of 100ms, but reduces the sleep time in unit tests to 10μs. This makes ensureNamespaceExists() run the for loop multiple times before giving up, fixing the test's flakiness.
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 - but I think that with these changes, now the pr description is a little out of sync.
I've decided to only keep my original change, as the other changes considerably slowed down the test. This test will probably be rewritten anyway. Also, although my original change reduces the sleep to just 1/100.000s, this only applies to the test itself, not when the code runs in production (there, the sleep is .1s long). In the test, this leads to the for loop running for around 5-15 loops, so it's not a big deal. It's still better than having a tight loop with no sleep (in that case, it does around 400-500 loops on my machine). |
/test istio-unit-2-1 Flaky |
/test istio-unit-2-1 |
/retest |
3 similar comments
/retest |
/retest |
/retest |
In response to a cherrypick label: new pull request created: #647 |
In response to a cherrypick label: new pull request created: #648 |
The sleep in ensureNamespaceExists was hardcoded to 100ms, regardless of r.handleEventTimeout. This timeout during unit tests is only 1ms, so the 100ms sleep caused the for loop to only run once.
Here we change the duration of the sleep to be 1/100 of r.handleEventTimeout. This change preserves the production sleep time of 100ms, but reduces the sleep time in unit tests to 10μs. This makes ensureNamespaceExists() run the for loop multiple times before giving up, fixing the test's flakiness.