Fix flaky ChannelInitializerTest.testChannelInitializerEventExecutor() (#8738)

Motivation:

testChannelInitializerEventExecutor() did sometimes fail as we sometimes miss to count down the latch. This can happen when we remove the handler from the pipeline before channelUnregistered(...) was called for it.

Modifications:

Countdown the latch in handlerRemoved(...).

Result:

Fix flaky test.
This commit is contained in:
Norman Maurer 2019-01-21 09:01:04 +01:00 committed by GitHub
parent 83b286f5d9
commit fabc6ee1bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -335,7 +335,7 @@ public class ChannelInitializerTest {
}
@Override
public void channelUnregistered(ChannelHandlerContext ctx) {
public void handlerRemoved(ChannelHandlerContext ctx) {
latch.countDown();
}
});
@ -369,6 +369,7 @@ public class ChannelInitializerTest {
client.closeFuture().sync();
server.closeFuture().sync();
// Wait until the handler is removed from the pipeline and so no more events are handled by it.
latch.await();
assertEquals(1, invokeCount.get());