mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-19 09:44:41 +08:00
Wait async connector in SelectorRecoveryTest
This commit is contained in:
parent
ac1fc887c5
commit
baf6c35e46
@ -51,9 +51,11 @@ internal class SelectorRecoveryTest : AbstractNettyNHTestWithSelector() {
|
||||
*/
|
||||
@Test
|
||||
fun `can recover on heartbeat failure with NettyChannelException`() = runBlockingUnit {
|
||||
// We allow IOException to cause a reconnect.
|
||||
// We allow NetworkException to cause a reconnect.
|
||||
testRecoverWhenHeartbeatFailWith { NettyChannelException("test IO ex") }
|
||||
|
||||
bot.components[EventDispatcher].joinBroadcast() // Wait our async connector to complete.
|
||||
|
||||
// BotOfflineMonitor immediately launches a recovery which is UNDISPATCHED, so connection is immediately recovered.
|
||||
assertState(NetworkHandler.State.CONNECTING, NetworkHandler.State.LOADING, NetworkHandler.State.OK)
|
||||
}
|
||||
@ -85,6 +87,8 @@ internal class SelectorRecoveryTest : AbstractNettyNHTestWithSelector() {
|
||||
bot.network.context[EventDispatcher].joinBroadcast()
|
||||
assertState(NetworkHandler.State.OK)
|
||||
|
||||
println("1")
|
||||
heartbeatScheduler.onHeartFailure("Test", exception())
|
||||
println("2")
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user