Repository navigation
fix(events): fix intermittent TestEventDispatcherBatchDispatchFail panic - #1798
Open
Thanatos9404 wants to merge 1 commit into
Open
Thanatos9404 wants to merge 1 commit into
Thanatos9404 wants to merge 1 commit into
Conversation
TestEventDispatcherBatchDispatchFail started the goroutine that calls bufferedDelivery before registering the GetMessageWithDataCached expectation. The goroutine could then call the mock while the expectation was missing or had no return values yet, so the test panicked (in CI with "no return value specified for GetMessageWithDataCached"). Register the expectation first, as the other tests in this file do. Fixes hyperledger-firefly#1662 Signed-off-by: Yashvardhan Thanvi <yashvt9404@gmail.com>
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Proposed changes
TestEventDispatcherBatchDispatchFailstarted the goroutine that callsbufferedDeliverybefore registering theGetMessageWithDataCachedexpectation, so the goroutine could reach the mock first and panic. This registers it first, asTestEventDispatcherBatchBaseddoes. The other tests in this file already set up their mocks before startingbufferedDelivery.Fixes #1662
Types of changes
Please make sure to follow these points
Other Information
On main the test panicked within 500 runs in each of five attempts on Windows. On Linux it needed load: with twelve copies running at once, nearly every copy panicked within 2,000 runs. With this change it passed 5,000 runs on Windows and 24,000 on Linux under the same load, and
internal/eventsstill passes with full coverage.