-
Notifications
You must be signed in to change notification settings - Fork 216
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
[Merged by Bors] - Fix hare3 unit tests #6754
Conversation
if err != nil { | ||
// This is 'allowed' error as it happens in some tests | ||
require.ErrorContains(cl.t, err, "dropped by graded gossip", "from = %d, to = %d", n.i, other.i) | ||
} else { | ||
require.NoError(cl.t, err, "from = %d, to = %d", n.i, other.i) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am unsure about this error assertion. What if a test that should not return an error here then returns "dropped by graded gossip"? Would it make sense to pass the expected error to the setup
method to make sure we catch if behaviour changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IDK it would be even more awkward. Ideally, the test in which these errors happen on purpose would have its own body and its own expectations.
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## develop #6754 +/- ##
=======================================
Coverage 76.8% 76.8%
=======================================
Files 369 369
Lines 50277 50278 +1
=======================================
+ Hits 38639 38645 +6
+ Misses 9427 9423 -4
+ Partials 2211 2210 -1 ☔ View full report in Codecov by Sentry. |
bors merge |
## Motivation Unflaking hare3 unit tests.
Pull request successfully merged into develop. Build succeeded: |
Motivation
Unflaking hare3 unit tests.
Description
In a failing test, one of the hares (in tests many hare nodes are talking to each other) doesn't receive all preround messages from other hares. In effect, this hare drops all proposals (they don't get enough votes).
The missing messages are sent but not delivered. The hare Handler rejects them because the hare hasn't set up the layer yet. Normally, in a real network this doesn't happen because hare waits preround delay. However, in the test, the time is emulated and moved manually. The test triggers a new layer and immediately moves time forward by the preround delay (effectively making the delay zero). Because of that there is a race between some hares being fast to send the preround message before other become ready to receive them.
This PR adds additional synchronization using the test tracer. The tracer is informed by calling its
OnStart()
method that hare started the layer. The test waits for this signal before it advances the time by preround delay.