Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing availability guards in tests #429

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import NIOHTTP1
import NIOHTTP2
import NIOTLS

@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
final class ConfiguringPipelineAsyncMultiplexerTests: XCTestCase {
var clientChannel: NIOAsyncTestingChannel!
var serverChannel: NIOAsyncTestingChannel!
Expand Down Expand Up @@ -150,6 +151,7 @@ final class ConfiguringPipelineAsyncMultiplexerTests: XCTestCase {

// `testNIOAsyncConnectionStreamChannelPipelineCommunicates` ensures that a client-server system set up to use `NIOAsyncChannel`
// wrappers around connection and stream channels can communicate successfully.
@available(*, deprecated, message: "Deprecated so deprecated functionality can be tested without warnings")
func testNIOAsyncConnectionStreamChannelPipelineCommunicates() async throws {
let requestCount = 100

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ final class HTTP2FramePayloadStreamMultiplexerTests: XCTestCase {
XCTAssertNoThrow(try self.channel.finish())
}

@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
func testFlushingOneChannelDoesntFlushThemAll() async throws {
let writeTracker = FrameWriteRecorder()
let (channelsStream, channelsContinuation) = AsyncStream.makeStream(of: Channel.self)
Expand Down Expand Up @@ -801,6 +802,7 @@ final class HTTP2FramePayloadStreamMultiplexerTests: XCTestCase {
XCTAssertNoThrow(try self.channel.finish())
}

@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
func testReadIsPerChannel() async throws {
let firstStreamID = HTTP2StreamID(1)
let secondStreamID = HTTP2StreamID(3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ final class HTTP2InlineStreamMultiplexerTests: XCTestCase {
XCTAssertNoThrow(try self.channel.finish())
}

@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
func testFlushingOneChannelDoesntFlushThemAll() async throws {
let writeTracker = IODataWriteRecorder()
let (channelsStream, channelsContinuation) = AsyncStream.makeStream(of: Channel.self)
Expand Down
2 changes: 2 additions & 0 deletions Tests/NIOHTTP2Tests/HTTP2StreamMultiplexerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@ final class HTTP2StreamMultiplexerTests: XCTestCase {
}

@available(*, deprecated, message: "Deprecated so deprecated functionality can be tested without warnings")
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
func testFlushingOneChannelDoesntFlushThemAll() async throws {
let writeTracker = FrameWriteRecorder()

Expand Down Expand Up @@ -998,6 +999,7 @@ final class HTTP2StreamMultiplexerTests: XCTestCase {
}

@available(*, deprecated, message: "Deprecated so deprecated functionality can be tested without warnings")
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
func testReadIsPerChannel() async throws {
let firstStreamID = HTTP2StreamID(1)
let secondStreamID = HTTP2StreamID(3)
Expand Down
6 changes: 6 additions & 0 deletions Tests/NIOHTTP2Tests/TestUtilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ extension XCTestCase {
/// they make no forward progress.
///
/// ** This function is racy and can lead to deadlocks, prefer the one-way variant which is less error-prone**
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
func interactInMemory(_ first: NIOAsyncTestingChannel, _ second: NIOAsyncTestingChannel, file: StaticString = #filePath, line: UInt = #line) async throws {
var operated: Bool

Expand All @@ -88,6 +89,7 @@ extension XCTestCase {
}

/// Have a `NIOAsyncTestingChannel` send data to another until it makes no forward progress.
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
static func deliverAllBytes(from source: NIOAsyncTestingChannel, to destination: NIOAsyncTestingChannel, file: StaticString = #filePath, line: UInt = #line) async throws {
var operated: Bool

Expand Down Expand Up @@ -157,6 +159,7 @@ extension XCTestCase {
///
/// If the handshake has not occurred, this will definitely call `XCTFail`. It may also throw if the
/// channel is now in an indeterminate state.
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
func assertDoHandshake(client: NIOAsyncTestingChannel, server: NIOAsyncTestingChannel,
clientSettings: [HTTP2Setting] = nioDefaultSettings, serverSettings: [HTTP2Setting] = nioDefaultSettings,
file: StaticString = #filePath, line: UInt = #line) async throws {
Expand Down Expand Up @@ -272,6 +275,7 @@ extension EmbeddedChannel {
}
}

@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
extension NIOAsyncTestingChannel {
/// This function attempts to obtain a HTTP/2 frame from a connection. It must already have been
/// sent, as this function does not call `interactInMemory`. If no frame has been received, this
Expand Down Expand Up @@ -896,6 +900,7 @@ func assertNoThrowWithValue<T>(
}
}

@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
func assertNoThrowWithValue<T>(
_ body: @autoclosure () async throws -> T,
defaultValue: T? = nil,
Expand All @@ -915,6 +920,7 @@ func assertNoThrowWithValue<T>(
}
}

@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
func assertNoThrow<T>(
_ body: @autoclosure () async throws -> T,
defaultValue: T? = nil,
Expand Down