File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed
Sources/HaystackClientNIO
Tests/HaystackClientNIOIntegrationTests Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -18,9 +18,9 @@ public extension Client {
1818 username: String ,
1919 password: String ,
2020 format: DataFormat = . zinc,
21- eventLoopGroup : EventLoopGroup
21+ httpClient : HTTPClient
2222 ) throws {
23- let fetcher = HTTPClient ( eventLoopGroupProvider : . shared ( eventLoopGroup ) ) . haystackFetcher ( )
23+ let fetcher = httpClient . haystackFetcher ( )
2424 try self . init (
2525 baseUrl: baseUrl,
2626 username: username,
Original file line number Diff line number Diff line change 1- import XCTest
1+ import AsyncHTTPClient
22import Haystack
33import HaystackClientNIO
44import NIO
5+ import XCTest
56
67/// To use these tests, run a [Haxall](https://github.com/haxall/haxall) server and set the username and password
78/// in the `HAYSTACK_USER` and `HAYSTACK_PASSWORD` environment variables
89final class HaystackClientNIOIntegrationTests : XCTestCase {
9- var client : Client = try ! Client (
10- baseUrl: " http://localhost:8080/api/ " ,
11- username: ProcessInfo . processInfo. environment [ " HAYSTACK_USER " ] ?? " su " ,
12- password: ProcessInfo . processInfo. environment [ " HAYSTACK_PASSWORD " ] ?? " su " ,
13- eventLoopGroup: MultiThreadedEventLoopGroup ( numberOfThreads: 1 )
14- )
10+ let eventLoopGroup = MultiThreadedEventLoopGroup ( numberOfThreads: 1 )
11+ var httpClient : HTTPClient !
12+ var client : Client !
1513
1614 override func setUp( ) async throws {
15+ httpClient = HTTPClient ( eventLoopGroupProvider: . shared( eventLoopGroup) )
16+ client = try Client (
17+ baseUrl: " http://localhost:8080/api/ " ,
18+ username: ProcessInfo . processInfo. environment [ " HAYSTACK_USER " ] ?? " su " ,
19+ password: ProcessInfo . processInfo. environment [ " HAYSTACK_PASSWORD " ] ?? " su " ,
20+ httpClient: httpClient
21+ )
1722 try await client. open ( )
1823 }
1924
2025 override func tearDown( ) async throws {
2126 try await client. close ( )
27+ try httpClient. syncShutdown ( )
2228 }
2329
2430 func testCloseAndOpen( ) async throws {
You can’t perform that action at this time.
0 commit comments