-
Notifications
You must be signed in to change notification settings - Fork 213
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
fix(iroh-net): Fix some flaky magicsock tests #2034
Conversation
This works for me, but used to be flaky. The way it is setup now should give use useful logs in case it fails.
this is somewhat more useful now that we use nextest
This is likely the bug that made all of these tests flaky. Let's see.
@@ -227,7 +227,11 @@ impl Debug for PublicKey { | |||
|
|||
impl Display for PublicKey { | |||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | |||
write!(f, "{}", base32::fmt(self.as_bytes())) | |||
if f.alternate() { |
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.
when/how is this triggered?
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.
When you use a #
formatter: {:#}
(or {:#?}
for Debug
)
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.
shouldn’t it be the other way around then,? # prints longer more detailed messages
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 could be rather tempted to switch this around and do the short format by default and the long format for alternate. That would reduce rather a lot of verbosity in our code.
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.
the issue is that, even externally, we rely on to_string()
roundtriping
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.
yeah, it'd probably break things if this can't be round-tripped. so maybe we'll have to settle for this.
## Description Fix flaky tests in iroh-net (hopefully). The main issue was that the testing code meshing together the sockets had a race-condition and would sometimes fail. Other improvements: - Logging improvements of various parts. These tests should now provide better info on failure. - Add alternative formatting of NodeId to use the short format. - Use NodeId in the public API, rather than PublicKey. - Move multi-threaded logging setup to the testing utils crate now that it can work properly. More code will have to switch. ## Notes & open questions The local_endpoints_change API is really difficult to use correctly. Even the way this testing code uses it now is wrong. Instead of the two current APIs there should be a single API which returns a stream. I'll do this as a separate followup PR though. ## Change checklist - [x] Self-review. - [x] Documentation updates if relevant. - [x] Tests if relevant.
## Description Fix flaky tests in iroh-net (hopefully). The main issue was that the testing code meshing together the sockets had a race-condition and would sometimes fail. Other improvements: - Logging improvements of various parts. These tests should now provide better info on failure. - Add alternative formatting of NodeId to use the short format. - Use NodeId in the public API, rather than PublicKey. - Move multi-threaded logging setup to the testing utils crate now that it can work properly. More code will have to switch. ## Notes & open questions The local_endpoints_change API is really difficult to use correctly. Even the way this testing code uses it now is wrong. Instead of the two current APIs there should be a single API which returns a stream. I'll do this as a separate followup PR though. ## Change checklist - [x] Self-review. - [x] Documentation updates if relevant. - [x] Tests if relevant.
Description
Fix flaky tests in iroh-net (hopefully). The main issue was that the
testing code meshing together the sockets had a race-condition and
would sometimes fail.
Other improvements:
Logging improvements of various parts. These tests should now
provide better info on failure.
Add alternative formatting of NodeId to use the short format.
Use NodeId in the public API, rather than PublicKey.
Move multi-threaded logging setup to the testing utils crate now
that it can work properly. More code will have to switch.
Notes & open questions
The local_endpoints_change API is really difficult to use correctly.
Even the way this testing code uses it now is wrong. Instead of the
two current APIs there should be a single API which returns a stream.
I'll do this as a separate followup PR though.
Change checklist