-
Notifications
You must be signed in to change notification settings - Fork 9
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
Fix flaky tests: Provider code is taken in test suite #5092
Conversation
9bdc780
to
fd21786
Compare
Is there another way to do this other than making DB queries until it works? |
Would it be better to select all the provider codes at once and use a code that wasn't in the result rather than generate, query, generate, query? |
Ok, I changed the implementation. Let me know your thoughts. |
Lets keep an eye on build / test times and see if this is slows down the test suite in the coming weeks |
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.
Let's keep an eye on the test suite to see if this makes it much slower
Move to a class so we can properly organise the code. Get the provider code first and then attempt to generate an unique provider code. I used #to_set Why .to_set? Set uses hash-based lookups, which are O(1) (constant time).
21b5a07
to
8918856
Compare
Context
We are seeing flaky tests in our test suite in Publish.
We need to adjust how the provider code is generated in the provider factory so that it is guaranteed to be unique.
Changes proposed in this pull request
Make sure provider code is unique when generating in tests.