mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-29 17:20:11 +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
|
@Test
|
||||||
fun `can recover on heartbeat failure with NettyChannelException`() = runBlockingUnit {
|
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") }
|
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.
|
// BotOfflineMonitor immediately launches a recovery which is UNDISPATCHED, so connection is immediately recovered.
|
||||||
assertState(NetworkHandler.State.CONNECTING, NetworkHandler.State.LOADING, NetworkHandler.State.OK)
|
assertState(NetworkHandler.State.CONNECTING, NetworkHandler.State.LOADING, NetworkHandler.State.OK)
|
||||||
}
|
}
|
||||||
@ -85,6 +87,8 @@ internal class SelectorRecoveryTest : AbstractNettyNHTestWithSelector() {
|
|||||||
bot.network.context[EventDispatcher].joinBroadcast()
|
bot.network.context[EventDispatcher].joinBroadcast()
|
||||||
assertState(NetworkHandler.State.OK)
|
assertState(NetworkHandler.State.OK)
|
||||||
|
|
||||||
|
println("1")
|
||||||
heartbeatScheduler.onHeartFailure("Test", exception())
|
heartbeatScheduler.onHeartFailure("Test", exception())
|
||||||
|
println("2")
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user