SDCSRM-388 Fix flaky unit test timing #62
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
This particular unit test was intermittently failing in the build pipeline when the result wasn't within the arbitrary time window. I spent some time looking at it but couldn't see any good reason this test would run slower than any others, so I'm concluding for now that it's not a particular issue with this function or test performance, and is more likely down to performance hiccups in the build environment, and we simply don't test this timing in many (if any) other places to see the issue. For now, I am fixing it by checking the timing differently, simply checking the timestamp is within the time window of the test.
What has changed
How to test?
Check the change. Nothing to test locally, the issue only seems to present in remote build environments.
Links
https://jira.ons.gov.uk/browse/SDCSRM-388