Browse Source

Use different test error (#1905)

Motivation:

Some tests arbitrarily used a CancellationError. This requires
availability guards on the tests which were missing.

Modifications:

- Switch to a different error type which doesn't require availability

Result:

Tests build on more platforms
George Barnett 1 year ago
parent
commit
427984137a

+ 3 - 2
Tests/GRPCHTTP2CoreTests/Client/Connection/ClientConnectionHandlerTests.swift

@@ -14,6 +14,7 @@
  * limitations under the License.
  * limitations under the License.
  */
  */
 
 
+import GRPCCore
 @_spi(Package) @testable import GRPCHTTP2Core
 @_spi(Package) @testable import GRPCHTTP2Core
 import NIOCore
 import NIOCore
 import NIOEmbedded
 import NIOEmbedded
@@ -231,7 +232,7 @@ final class ClientConnectionHandlerTests: XCTestCase {
     XCTAssertEqual(try connection.readEvent(), .ready)
     XCTAssertEqual(try connection.readEvent(), .ready)
 
 
     // Write an error and close.
     // Write an error and close.
-    let error = CancellationError()
+    let error = RPCError(code: .aborted, message: "")
     connection.channel.pipeline.fireErrorCaught(error)
     connection.channel.pipeline.fireErrorCaught(error)
     connection.channel.close(mode: .all, promise: nil)
     connection.channel.close(mode: .all, promise: nil)
 
 
@@ -250,7 +251,7 @@ final class ClientConnectionHandlerTests: XCTestCase {
     connection.streamOpened(1)
     connection.streamOpened(1)
 
 
     // Write an error and close.
     // Write an error and close.
-    let error = CancellationError()
+    let error = RPCError(code: .aborted, message: "")
     connection.channel.pipeline.fireErrorCaught(error)
     connection.channel.pipeline.fireErrorCaught(error)
     connection.channel.close(mode: .all, promise: nil)
     connection.channel.close(mode: .all, promise: nil)