Forráskód Böngészése

Add missing availbility guards in tests (#1866)

Motivation:

Some test helpers were missing availbility guards. Also, some tests used
integer literal which would overlflow an `Int` when it's only 32-bits.

Modifications:

- Add missing availbility guards
- Use Int64 explicitly to avoid overlflow

Result:

Tests build on other platforms
George Barnett 1 éve
szülő
commit
18e920db4e

+ 1 - 0
Tests/GRPCHTTP2CoreTests/Client/Connection/ConnectionTests.swift

@@ -182,6 +182,7 @@ final class ConnectionTests: XCTestCase {
 }
 
 extension ClientBootstrap {
+  @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
   func connect<T>(
     to address: GRPCHTTP2Core.SocketAddress,
     _ configure: @Sendable @escaping (Channel) -> EventLoopFuture<T>

+ 6 - 0
Tests/GRPCHTTP2CoreTests/Client/Connection/Utilities/HTTP2Connectors.swift

@@ -21,6 +21,7 @@ import NIOHTTP2
 import NIOPosix
 
 @_spi(Package)
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
 extension HTTP2Connector where Self == ThrowingConnector {
   /// A connector which throws the given error on a connect attempt.
   static func throwing(_ error: RPCError) -> Self {
@@ -29,6 +30,7 @@ extension HTTP2Connector where Self == ThrowingConnector {
 }
 
 @_spi(Package)
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
 extension HTTP2Connector where Self == NeverConnector {
   /// A connector which fatal errors if a connect attempt is made.
   static var never: Self {
@@ -37,6 +39,7 @@ extension HTTP2Connector where Self == NeverConnector {
 }
 
 @_spi(Package)
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
 extension HTTP2Connector where Self == NIOPosixConnector {
   /// A connector which uses NIOPosix to establish a connection.
   static func posix(
@@ -56,6 +59,7 @@ extension HTTP2Connector where Self == NIOPosixConnector {
   }
 }
 
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
 struct ThrowingConnector: HTTP2Connector {
   private let error: RPCError
 
@@ -70,6 +74,7 @@ struct ThrowingConnector: HTTP2Connector {
   }
 }
 
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
 struct NeverConnector: HTTP2Connector {
   func establishConnection(
     to address: GRPCHTTP2Core.SocketAddress
@@ -78,6 +83,7 @@ struct NeverConnector: HTTP2Connector {
   }
 }
 
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
 struct NIOPosixConnector: HTTP2Connector {
   private let eventLoopGroup: any EventLoopGroup
   private let maxIdleTime: TimeAmount?