Browse Source

Fix tests to work with unreleased swift-nio changes (#2001)

Honza Dvorsky 1 year ago
parent
commit
1f067db204
1 changed files with 9 additions and 3 deletions
  1. 9 3
      Tests/GRPCTests/ConnectionManagerTests.swift

+ 9 - 3
Tests/GRPCTests/ConnectionManagerTests.swift

@@ -989,6 +989,9 @@ extension ConnectionManagerTests {
     let manager = self.makeConnectionManager(configuration: configuration) { _, _ in
       self.loop.makeFailedFuture(DoomedChannelError())
     }
+    defer {
+      try! manager.shutdown().wait()
+    }
 
     self.waitForStateChanges([
       Change(from: .idle, to: .connecting),
@@ -1154,9 +1157,7 @@ extension ConnectionManagerTests {
 
   func testHTTP2Delegates() throws {
     let channel = EmbeddedChannel(loop: self.loop)
-    defer {
-      XCTAssertNoThrow(try channel.finish())
-    }
+    // The channel gets shut down by the connection manager.
 
     let multiplexer = HTTP2StreamMultiplexer(
       mode: .client,
@@ -1215,6 +1216,11 @@ extension ConnectionManagerTests {
       http2Delegate: http2,
       logger: self.logger
     )
+    defer {
+      let future = manager.shutdown()
+      self.loop.run()
+      try! future.wait()
+    }
 
     // Start connecting.
     let futureMultiplexer = manager.getHTTP2Multiplexer()