Wait for test cleanup. (#280)

Motivation:

The current test function does not wait for the futures from close to
return, and so they may in principle be leaked. This obscures errors that
the test might hit with precondition failures.

Modifications:

Changed the defer statements to wait for the futures.

Result:

Fewer spurious test failures.
This commit is contained in:
Cory Benfield authored and Norman Maurer committed 2018-04-04 20:17:02 +02:00
1 parent 851dad09af
commit 85b835863f
1 file changed
+2 -2
+2 -2
View File
@@ -653,7 +653,7 @@ class EchoServerClientTest : XCTestCase {
}.bind(host: "127.0.0.1", port: 0).wait()
defer {
_ = serverChannel.close()
XCTAssertNoThrow(try serverChannel.syncCloseAcceptingAlreadyClosed())
}
let clientChannel = try ClientBootstrap(group: group)
@@ -666,7 +666,7 @@ class EchoServerClientTest : XCTestCase {
}
}.connect(to: serverChannel.localAddress!).wait()
defer {
_ = clientChannel.close()
XCTAssertNoThrow(try clientChannel.syncCloseAcceptingAlreadyClosed())
}
dpGroup.wait()