Skip to content
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

rt: improve rng_seed test robustness #5075

Merged
merged 1 commit into from Oct 5, 2022
Merged

Conversation

hds
Copy link
Contributor

@hds hds commented Oct 4, 2022

Motivation

The original tests for the Builder::rng_seed added in #4910 were a bit fragile. There have already been a couple of instances where internal refactoring caused the tests to fail and need to be modified. While it is expected that internal refactoring may cause the random values to change, this shouldn't cause the tests to break.

Solution

The tests should be more robust and not be affected by internal refactoring or changes in the Rust compiler version. The tests are changed to perform the same operation in 2 runtimes created with the same seed, the expectation is that the values that result from each runtime are the same.

The original tests for the `Builder::rng_seed` added in #4910 were a bit
fragile. There have already been a couple of instances where internal
refactoring caused the tests to fail and need to be modified. While it
is expected that internal refactoring may cause the random values to
change, this shouldn't cause the tests to break.

The tests should be more robust and not be affected by internal
refactoring or changes in the Rust compiler version. The tests are
changed to perform the same operation in 2 runtimes created with the
same seed, the expectation is that the values that result from each
runtime are the same.
@Darksonn Darksonn added A-tokio Area: The main tokio crate M-runtime Module: tokio/runtime labels Oct 5, 2022
@hds hds merged commit 9b48635 into master Oct 5, 2022
@hds hds deleted the hds/rng-seed-test-robustness branch October 5, 2022 12:31
hds added a commit that referenced this pull request Oct 27, 2022
The improvement to the `rng_seed` tests added in #5075 missed a case in
the `rt_threaded` tests which was still checking for a specific value.
As described in that PR, this makes the tests fragile and changing tokio
internals may require updating the test.

This change fixes that half-implemented improvement so that the tests no
longer depend on the exact internal ordering, but rather compare two
runs of separate runtimes built with the same seed to check that the
results are the same.
hds added a commit that referenced this pull request Oct 27, 2022
The improvement to the `rng_seed` tests added in #5075 missed a case in
the `rt_threaded` tests which was still checking for a specific value.
As described in that PR, this makes the tests fragile and changing tokio
internals may require updating the test.

This change fixes that half-implemented improvement so that the tests no
longer depend on the exact internal ordering, but rather compare two
runs of separate runtimes built with the same seed to check that the
results are the same.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-runtime Module: tokio/runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants