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

examples: Add sleep to fix flaky test #2129

Merged
merged 1 commit into from
Feb 24, 2023
Merged

Conversation

MarcoPolo
Copy link
Collaborator

If we end the test right away we may miss logging the "Established Connection" line that this test checks for.

@@ -43,6 +44,8 @@ func TestMain(t *testing.T) {

go startPeer(ctx, h1, func(network.Stream) {
log.Println("Got a new stream!")
// Sleep a bit to let h2 print the logs we're waiting for
time.Sleep(500 * time.Millisecond)
Copy link
Contributor

Choose a reason for hiding this comment

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

This would be nicer with a proper synchronization mechanism, but I'm fine with merging this for now.

@MarcoPolo MarcoPolo merged commit 7043217 into master Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants