Skip long internal/p2p/conn tests in -short mode

I added checks against testing.Short for tests that took longer than
about one second on my machine. Running with -short reduces the test
time of internal/p2p/conn from about 21.7s to about 1.9s.
This commit is contained in:
Mark Rushakoff
2022-07-22 11:51:21 -04:00
parent 4ee92a6a15
commit 6daef21b52

View File

@@ -315,6 +315,10 @@ func TestMConnectionMultiplePings(t *testing.T) {
}
func TestMConnectionPingPongs(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
// check that we are not leaking any go-routines
t.Cleanup(leaktest.CheckTimeout(t, 10*time.Second))
@@ -558,6 +562,10 @@ func TestMConnectionReadErrorUnknownMsgType(t *testing.T) {
}
func TestMConnectionTrySend(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
server, client := net.Pipe()
t.Cleanup(closeAll(t, client, server))
ctx, cancel := context.WithCancel(context.Background())
@@ -606,6 +614,10 @@ func TestConnVectors(t *testing.T) {
}
func TestMConnectionChannelOverflow(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
chOnErr := make(chan struct{})
chOnRcv := make(chan struct{})