#37371 closed task (blessed) (fixed)
Reduce reliance on randomness in tests for 5.9
Reported by: | johnbillion | Owned by: | johnbillion |
---|---|---|---|
Milestone: | 5.9 | Priority: | lowest |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | has-patch has-unit-tests |
Focuses: | Cc: |
Description
39 of core's tests rely on rand_str()
returning a different value each time it's called in order to pass. It's entirely possible that rand_str()
could return an identical value twice, and therefore the test would randomly (ho ho) fail.
Let's remove all the unnecessary uses of rand_str()
, where a fixed string would suffice. This will also shave off some milliseconds.
Attachments (2)
Change History (23)
#4
@
8 years ago
@johnbillion Do you want to remove the rest of the calls to rand_str
l? If so, good first bug?
#5
@
8 years ago
- Keywords needs-patch good-first-bug added; has-patch removed
- Milestone changed from 4.7 to Future Release
#6
@
8 years ago
- Keywords good-first-bug removed
- Owner set to johnbillion
- Status changed from new to accepted
- Summary changed from Reduce reliance on rand_str() in tests to Reduce reliance on randomness in tests
There's also a bunch of instances of rand()
in tests which are just as unnecessary.
#11
@
5 years ago
- Keywords reporter-feedback added
@johnbillion is there any more work to be done here? Can we wrap this up during 5.4?
#12
@
5 years ago
- Keywords reporter-feedback removed
- Milestone changed from Future Release to 5.4
- Priority changed from normal to low
@
3 years ago
Replace other rand_str()
and rand()
calls with static string to eliminate unnecessary randomness in tests. This is my first patch.
#17
@
3 years ago
- Keywords good-first-bug removed
- Milestone changed from Future Release to 5.9
- Summary changed from Reduce reliance on randomness in tests to Reduce reliance on randomness in tests for 5.9
- Type changed from enhancement to task (blessed)
I'm moving this into 5.9 to get the patch from @johnillo reviewed and committed before it goes too stale. This ticket can then be closed and any remaining unnecessary randomness can be addressed in follow-up tickets.
This ticket was mentioned in PR #2023 on WordPress/wordpress-develop by johnbillion.
3 years ago
#18
- Keywords has-unit-tests added
Patch from johnillo. Opening a PR so we can verify that the tests pass.
Trac ticket: https://core.trac.wordpress.org/ticket/37371
37371.patch replaces all instances of
rand_str()
with static strings where the test will fail ifrand_str()
were to return sequential identical strings.