-
Notifications
You must be signed in to change notification settings - Fork 84
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
The unit test test_shrink
make no sense
#114
Comments
One of the problems is, that we don't have control over the OS and the other tasks on the machine. Depending on the load, sleeping for 100ms may not be enough for the workers to settle down in time. I am currently rewriting the crate to make it faster and more flexible, but the focus again is on faster work speeds not faster admin reactions. May I ask, how did you stumble over this test :) |
Sorry for my late reply. 1. The reason for my fail test
|
In the
test_shrink
, if comment the function callpool.set_num_threads(TEST_TASKS);
, the test also can pass. Becauseafter_shrink_size == TEST_TASKS
andactive threads == TEST_TASKS
.Then I want to try write a test case that can test shrink, but it will test fail sometimes (because the implementation in lib.rs).
The code is as follows,
test_no_shrink
is for the origin test case I metion above,test_shrink_in_sleep
is my custom test case usingsleep
.This is the test result:
Although I know the thread pool does not need such a precise shrink, I want to ask how to write a test case to test whether the shrink really works and the test case can pass everytime.
The text was updated successfully, but these errors were encountered: