-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make random UUIDs reproducible in tests
Today we use a random source of UUIDs for assigning allocation IDs, cluster IDs, etc. Yet, the source of randomness for this is not reproducible in tests. Since allocation IDs end up as keys in hash maps, this means allocation decisions and not reproducible in tests and this leads to non-reproducible test failures. This commit modifies the behavior of random UUIDs so that they are reproducible under tests. The behavior for production code is not changed, we still use a true source of secure randomness but under tests we just use a reproducible source of non-secure randomness. It is important to note that there is a test, UUIDTests#testThreadedRandomUUID that relies on the UUIDs being truly random. Thus, we have to modify the setup for this test to use a true source of randomness. Thus, this is one test that will never be reproducible but it is intentionally so. Relates #18808
- Loading branch information
1 parent
43e07c0
commit a25b8ee
Showing
5 changed files
with
83 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters