Skip to content

Commit

Permalink
Fix HBXCTLive throwing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler committed Dec 21, 2023
1 parent 57a2ec5 commit c9ee787
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Sources/Hummingbird/Codable/CodableProtocols.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ public struct NullEncoder: HBResponseEncoder {
public struct NullDecoder: HBRequestDecoder {
public init() {}
public func decode<T: Decodable>(_ type: T.Type, from request: HBRequest, context: some HBBaseRequestContext) throws -> T {
preconditionFailure("HBApplication.decoder has not been set")
preconditionFailure("Request context decoder has not been set")

Check warning on line 52 in Sources/Hummingbird/Codable/CodableProtocols.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Hummingbird/Codable/CodableProtocols.swift#L52

Added line #L52 was not covered by tests
}
}
20 changes: 13 additions & 7 deletions Sources/HummingbirdXCT/HBXCTLive.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ final class HBXCTLive<App: HBApplicationProtocol>: HBXCTApplication {
}

init(app: App) {
self.timeout = .seconds(15)
self.timeout = .seconds(20)
self.application = TestApplication(base: app)
}

Expand All @@ -64,17 +64,23 @@ final class HBXCTLive<App: HBApplicationProtocol>: HBXCTApplication {
let client = HBXCTClient(
host: "localhost",
port: port,
configuration: .init(timeout: .seconds(2)),
configuration: .init(timeout: self.timeout),
eventLoopGroupProvider: .createNew
)
client.connect()
let value = try await test(Client(client: client))
await serviceGroup.triggerGracefulShutdown()
try await client.shutdown()
return value
do {
let value = try await test(Client(client: client))
await serviceGroup.triggerGracefulShutdown()
try await client.shutdown()
return value
} catch {
await serviceGroup.triggerGracefulShutdown()
try await client.shutdown()
throw error

Check warning on line 79 in Sources/HummingbirdXCT/HBXCTLive.swift

View check run for this annotation

Codecov / codecov/patch

Sources/HummingbirdXCT/HBXCTLive.swift#L77-L79

Added lines #L77 - L79 were not covered by tests
}
}
}

let application: TestApplication<App>
let timeout: TimeAmount
let timeout: Duration
}

0 comments on commit c9ee787

Please sign in to comment.