Skip to content

fix test faling with NIOTS #257

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

Merged
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
8 changes: 7 additions & 1 deletion Tests/AsyncHTTPClientTests/HTTPClientInternalTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,23 @@ class HTTPClientInternalTests: XCTestCase {
typealias Request = HTTPClient.Request
typealias Task = HTTPClient.Task

var serverGroup: EventLoopGroup!
var clientGroup: EventLoopGroup!

override func setUp() {
XCTAssertNil(self.clientGroup)
XCTAssertNil(self.serverGroup)
self.serverGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1)
self.clientGroup = getDefaultEventLoopGroup(numberOfThreads: 1)
}

override func tearDown() {
XCTAssertNotNil(self.serverGroup)
XCTAssertNoThrow(try self.serverGroup.syncShutdownGracefully())
XCTAssertNotNil(self.clientGroup)
XCTAssertNoThrow(try self.clientGroup.syncShutdownGracefully())
self.clientGroup = nil
self.serverGroup = nil
}

func testHTTPPartsHandler() throws {
Expand Down Expand Up @@ -833,7 +839,7 @@ class HTTPClientInternalTests: XCTestCase {
}

func testUncleanCloseThrows() {
let server = NIOHTTP1TestServer(group: self.clientGroup)
let server = NIOHTTP1TestServer(group: self.serverGroup)
defer {
XCTAssertNoThrow(try server.stop())
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/AsyncHTTPClientTests/HTTPClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2031,7 +2031,7 @@ class HTTPClientTests: XCTestCase {
let second = elg.next()
XCTAssertFalse(first === second)

let httpServer = NIOHTTP1TestServer(group: first)
let httpServer = NIOHTTP1TestServer(group: self.serverGroup)
let httpClient = HTTPClient(eventLoopGroupProvider: .shared(first))
defer {
XCTAssertNoThrow(try httpClient.syncShutdown())
Expand Down