test: minimize interchange debouce test race condition #11259
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request prevent some race condition by improving the interchange debounce test precision caused by an asynchronous usage of timeouts. Timeout delays are most often not respected and the differences between several timeouts running in parrallel can be huge.
Partially replaces #11214
Changes:
Note about the race condition:
I don't think it is possible to fully remove any race condition in this test. We want to test a behavior within a 10ms delay but we have no certainty that the used timeout will be triggered when expected and not latter.
We can increase the debounce time used in the test to ensure that all the "resize" will be triggered within the debounce interval.
An other solution could be to trigger a huge number of "resize" events and test if
_reflow
got called up to one time per debounce interval. But how to be synchronised with these debounce interval, and could this make the test way too specific ?Note about the commit convention:
I was not sure before wether of the
fix
ortest
prefix we should use for this "test fix". According to the Angular commit convention it should betest
:Types of changes
functionality to change)
Checklist (all required):
develop
orsupport/*
).