Stop clearing all watches in the mock trigger engine. #39724
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.
Our watcher integration tests use
ScheduleTriggerEngineMock
to give morecontrol over when watches are triggered. This mock trigger engine maintains a
reference to all registered watches. We've seen a few instances of tests
failing because
ScheduleTriggerEngineMock
could no longer find a watch thatwas previously added (for example #35503, #37882, and #39306)
The issue seems to be that after the tests starts, there can be a change in
local shard routing, which then causes the watch service to be loaded. This in
turn calls
ScheduleTriggerEngineMock#pauseExecution
, which clears all watchesthat this mock object holds. Subsequent calls to
ScheduleTriggerEngineMock#trigger
then fail to find the requested watches.This PR proposes to stop clearing the watches in
ScheduleTriggerEngineMock#pauseExecution
. Usually, pausing execution on atrigger engine will stop scheduled watches from running. However, the mock
trigger engine does not run watches on a schedule, and instead allows them to
be triggered manually. So arguably, no action should be taken in
pauseExecution
, and in particular it doesn't make sense to clear the list ofregistered watches.
Addresses #35503 and #39306.