remove unnecesary sleeps (#434)

This commit is contained in:
Dmitriy Ryajov 2020-11-12 14:18:17 -06:00 committed by GitHub
parent da37eee285
commit 23ffd1f9f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 18 deletions

View File

@ -241,12 +241,11 @@ suite "Switch":
check switch1.isConnected(switch2.peerInfo) check switch1.isConnected(switch2.peerInfo)
check switch2.isConnected(switch1.peerInfo) check switch2.isConnected(switch1.peerInfo)
await sleepAsync(100.millis)
await switch2.disconnect(switch1.peerInfo) await switch2.disconnect(switch1.peerInfo)
await sleepAsync(2.seconds)
check not switch1.isConnected(switch2.peerInfo)
check not switch2.isConnected(switch1.peerInfo) check not switch2.isConnected(switch1.peerInfo)
await sleepAsync(1.millis)
check not switch1.isConnected(switch2.peerInfo)
checkTracker(LPChannelTrackerName) checkTracker(LPChannelTrackerName)
checkTracker(SecureConnTrackerName) checkTracker(SecureConnTrackerName)
@ -295,12 +294,11 @@ suite "Switch":
check switch1.isConnected(switch2.peerInfo) check switch1.isConnected(switch2.peerInfo)
check switch2.isConnected(switch1.peerInfo) check switch2.isConnected(switch1.peerInfo)
await sleepAsync(100.millis)
await switch2.disconnect(switch1.peerInfo) await switch2.disconnect(switch1.peerInfo)
await sleepAsync(2.seconds)
check not switch1.isConnected(switch2.peerInfo)
check not switch2.isConnected(switch1.peerInfo) check not switch2.isConnected(switch1.peerInfo)
await sleepAsync(1.millis)
check not switch1.isConnected(switch2.peerInfo)
checkTracker(LPChannelTrackerName) checkTracker(LPChannelTrackerName)
checkTracker(SecureConnTrackerName) checkTracker(SecureConnTrackerName)
@ -355,12 +353,11 @@ suite "Switch":
check switch1.isConnected(switch2.peerInfo) check switch1.isConnected(switch2.peerInfo)
check switch2.isConnected(switch1.peerInfo) check switch2.isConnected(switch1.peerInfo)
await sleepAsync(100.millis)
await switch2.disconnect(switch1.peerInfo) await switch2.disconnect(switch1.peerInfo)
await sleepAsync(2.seconds)
check not switch1.isConnected(switch2.peerInfo)
check not switch2.isConnected(switch1.peerInfo) check not switch2.isConnected(switch1.peerInfo)
await sleepAsync(1.millis)
check not switch1.isConnected(switch2.peerInfo)
checkTracker(LPChannelTrackerName) checkTracker(LPChannelTrackerName)
checkTracker(SecureConnTrackerName) checkTracker(SecureConnTrackerName)
@ -414,12 +411,11 @@ suite "Switch":
check switch1.isConnected(switch2.peerInfo) check switch1.isConnected(switch2.peerInfo)
check switch2.isConnected(switch1.peerInfo) check switch2.isConnected(switch1.peerInfo)
await sleepAsync(100.millis)
await switch2.disconnect(switch1.peerInfo) await switch2.disconnect(switch1.peerInfo)
await sleepAsync(2.seconds)
check not switch1.isConnected(switch2.peerInfo)
check not switch2.isConnected(switch1.peerInfo) check not switch2.isConnected(switch1.peerInfo)
await sleepAsync(1.millis)
check not switch1.isConnected(switch2.peerInfo)
checkTracker(LPChannelTrackerName) checkTracker(LPChannelTrackerName)
checkTracker(SecureConnTrackerName) checkTracker(SecureConnTrackerName)
@ -473,12 +469,11 @@ suite "Switch":
check switch1.isConnected(switch2.peerInfo) check switch1.isConnected(switch2.peerInfo)
check switch2.isConnected(switch1.peerInfo) check switch2.isConnected(switch1.peerInfo)
await sleepAsync(100.millis)
await switch2.disconnect(switch1.peerInfo) await switch2.disconnect(switch1.peerInfo)
await sleepAsync(2.seconds)
check not switch1.isConnected(switch2.peerInfo)
check not switch2.isConnected(switch1.peerInfo) check not switch2.isConnected(switch1.peerInfo)
await sleepAsync(1.millis)
check not switch1.isConnected(switch2.peerInfo)
checkTracker(LPChannelTrackerName) checkTracker(LPChannelTrackerName)
checkTracker(SecureConnTrackerName) checkTracker(SecureConnTrackerName)
@ -545,14 +540,13 @@ suite "Switch":
check switch2.isConnected(switch1.peerInfo) check switch2.isConnected(switch1.peerInfo)
check switch3.isConnected(switch1.peerInfo) check switch3.isConnected(switch1.peerInfo)
await sleepAsync(100.millis)
await switch2.disconnect(switch1.peerInfo) # should trigger 1st Left event await switch2.disconnect(switch1.peerInfo) # should trigger 1st Left event
await switch3.disconnect(switch1.peerInfo) # should trigger 2nd Left event await switch3.disconnect(switch1.peerInfo) # should trigger 2nd Left event
await sleepAsync(2.seconds)
check not switch1.isConnected(switch2.peerInfo)
check not switch2.isConnected(switch1.peerInfo) check not switch2.isConnected(switch1.peerInfo)
check not switch3.isConnected(switch1.peerInfo) check not switch3.isConnected(switch1.peerInfo)
await sleepAsync(1.millis)
check not switch1.isConnected(switch2.peerInfo)
checkTracker(LPChannelTrackerName) checkTracker(LPChannelTrackerName)
checkTracker(SecureConnTrackerName) checkTracker(SecureConnTrackerName)