Skip to content
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): Try to fix flaky test_token_passthrough test #1419

Merged
merged 1 commit into from
Aug 28, 2023

Conversation

flub
Copy link
Contributor

@flub flub commented Aug 28, 2023

Description

This seems to fail often on CI on the emulated platforms when the
machines are busy. And the failures we see are timeouts. So very
likely increasing this timeout should help.

Does a few smaller fixes:

  • Only bind on localhost instead of exposing us to the world. Tests
    should not expose themselves to the world.

  • Make sure that the receiver dropping is caught in a panic.

Notes & open questions

Change checklist

  • Self-review.
  • Documentation updates if relevant.
  • Tests if relevant.

This seems to fail often on CI on the emulated platforms when the
machines are busy.  And the failures we see are timeouts.  So very
likely increasing this timeout should help.

Does a few smaller fixes:

- Only bind on localhost instead of exposing us to the world.  Tests
  should not expose themselves to the world.

- Make sure that the receiver dropping is caught in a panic.
@flub flub requested review from rklaehn and dignifiedquire August 28, 2023 12:33
@flub flub enabled auto-merge August 28, 2023 12:55
@@ -877,7 +877,7 @@ async fn test_token_passthrough() -> Result<()> {
let rt = test_runtime();
let expected = b"hello".to_vec();
let (db, hash) = create_test_db([("test", expected.clone())]);
let addr = "0.0.0.0:0".parse().unwrap();
let addr = SocketAddr::from((Ipv4Addr::LOCALHOST, 0));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just drive by boyscouting, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what you mean, but this is not crucial to the fix as the description says. it is an orthogonal fix because I think no test should ever open public ports

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this is no change, no? It's just a nicer way to write the same thing without parse and unwrap.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's that as well. but I also is a change. before it listened on 0.0.0.0, now it listens on 127.0.0.1.

@@ -894,7 +894,7 @@ async fn test_token_passthrough() -> Result<()> {
if let iroh_bytes::provider::Event::GetRequestReceived { token: tok, .. } =
bp_msg
{
events_sender.send(tok).ok();
events_sender.send(tok).expect("receiver dropped");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this fix the test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't. as per description it ensures we get a panic if this ever is an issue in one of the flakes. this is more belt-and-braces as i expect the timeout to work, but with flaky tests you can't be explicit enough.

@flub flub added this pull request to the merge queue Aug 28, 2023
@flub flub requested a review from rklaehn August 28, 2023 13:06
Merged via the queue into main with commit a1d4a4d Aug 28, 2023
@flub flub deleted the flub/token-passthrough-flake branch August 28, 2023 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants