Skip to content

Commit

Permalink
fix flaky reconnect test (#1406)
Browse files Browse the repository at this point in the history
* don't run the reconnect test using TCP on OSX

Due to golang/go#50254.

* don't check the error return value when closing stream in reconnect test
  • Loading branch information
marten-seemann authored Apr 18, 2022
1 parent fc2174c commit 19b4545
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions p2p/test/reconnects/reconnect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"io"
"math/rand"
"runtime"
"sync"
"testing"
"time"
Expand Down Expand Up @@ -49,6 +50,9 @@ func TestReconnect5(t *testing.T) {
}

t.Run("using TCP", func(t *testing.T) {
if runtime.GOOS == "darwin" {
t.Skip("TCP RST handling is flaky in OSX, see https://github.com/golang/go/issues/50254")
}
runTest(t, swarmt.OptDisableQUIC)
})

Expand Down Expand Up @@ -91,9 +95,9 @@ func runRound(t *testing.T, hosts []host.Host) {
rand.Read(data)
str, err := h1.NewStream(context.Background(), h2.ID(), protocol.TestingID)
require.NoError(t, err)
defer str.Close()
_, err = str.Write(data)
require.NoError(t, err)
require.NoError(t, str.Close())
}()
}
wg.Wait()
Expand Down Expand Up @@ -121,5 +125,5 @@ func runRound(t *testing.T, hosts []host.Host) {
}
}
return true
}, 500*time.Millisecond, 10*time.Millisecond)
}, 5000*time.Millisecond, 10*time.Millisecond)
}

0 comments on commit 19b4545

Please sign in to comment.