-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update async processor tests (#2577)
Closes #2449 Or at least, tries to :) ## Description Summary of changes, each in separate commit for clarity. The change that attempts to fix the actual flakiness reported in the issue in pt. 2 below: 1. Modify `one_spawn_single_tasks_works()` to not use `sleep` 2. Updates assertion in `one_spawn_single_tasks_works__thread_id_is_different_than_main()` * The original test expected the exact number of worker threads to be spawned (`assert_eq!(unique_thread_ids.len(), number_of_threads);`), however, the `AsyncProcessor` can potentially reuse threads if the tasks finish quick enough. * One way to reduce the flakiness would be to bump the sleep, but I think the more clear way is to ensure that _some_ (but not too many) worker threads have been spawned * Especially because the aim of the test is not to ensure the number of worker threads, but to check that main thread id was not used 3. Reduces the arbitrary number of tasks in `executes_10_tasks_for_10_seconds_with_one_thread`, just to make the test execute faster 4. Add some clarifying comments 5. Slightly update and rename the `executes_10_tasks_for_2_seconds_with_10_thread()` and `executes_10_tasks_for_2_seconds_with_1_thread()` - to use proper values and better reflect the idea behind the test ### Before requesting review - [X] I have reviewed the code myself
- Loading branch information
Showing
1 changed file
with
62 additions
and
43 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