Add sleep to fix flaky test (#2129)

This commit is contained in:
Marco Munizaga 2023-02-24 09:54:20 -08:00 committed by GitHub
parent 29785d22b3
commit 704321763e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import (
"fmt"
"log"
"testing"
"time"
"github.com/libp2p/go-libp2p/core/network"
@ -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)
cancel() // end the test
})