From 36321d080e239c6704d00f9dca2f0ec3f475a4e1 Mon Sep 17 00:00:00 2001 From: Cory Benfield Date: Sun, 20 May 2018 11:18:25 +0100 Subject: [PATCH] Clean up tests. (#9) Motivation: Our tests were failing as a result of the previous commit changing the HTTP/2 lifecycle. Modifications: Fired channelActive in a few tests, correctly propagated channelInactive. Result: Tests should pass. --- Sources/NIOHTTP2/HTTP2Parser.swift | 1 - Tests/NIOHTTP2Tests/TestUtilities.swift | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/NIOHTTP2/HTTP2Parser.swift b/Sources/NIOHTTP2/HTTP2Parser.swift index 3f26e0f..a67e0bf 100644 --- a/Sources/NIOHTTP2/HTTP2Parser.swift +++ b/Sources/NIOHTTP2/HTTP2Parser.swift @@ -192,7 +192,6 @@ public final class HTTP2Parser: ChannelInboundHandler, ChannelOutboundHandler { public func channelInactive(ctx: ChannelHandlerContext) { self.reentrancyManager.eofType = .channelInactive self.reentrancyManager.process(ctx: ctx, self.process) - ctx.fireChannelInactive() } public func userInboundEventTriggered(ctx: ChannelHandlerContext, event: Any) { diff --git a/Tests/NIOHTTP2Tests/TestUtilities.swift b/Tests/NIOHTTP2Tests/TestUtilities.swift index bac07ac..745726d 100644 --- a/Tests/NIOHTTP2Tests/TestUtilities.swift +++ b/Tests/NIOHTTP2Tests/TestUtilities.swift @@ -79,6 +79,9 @@ extension XCTestCase { func assertDoHandshake(client: EmbeddedChannel, server: EmbeddedChannel, clientSettings: [HTTP2Setting] = nioDefaultSettings, serverSettings: [HTTP2Setting] = nioDefaultSettings, file: StaticString = #file, line: UInt = #line) throws { + client.pipeline.fireChannelActive() + server.pipeline.fireChannelActive() + // First the channels need to interact. self.interactInMemory(client, server, file: file, line: line)