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

2.x.x - Add AsyncHTTPClient testing setup #317

Merged
merged 5 commits into from
Dec 21, 2023
Merged

2.x.x - Add AsyncHTTPClient testing setup #317

merged 5 commits into from
Dec 21, 2023

Conversation

adam-fowler
Copy link
Member

@adam-fowler adam-fowler commented Dec 20, 2023

Some testing requires a more fully featured HTTP client. This PR adds a testing framework that uses AsyncHTTPClient

try await app.test(.ahc(.https)) { client in
    client.XCTExecute(uri: "/", method: .get) { response in
    ...

This PR also merges HummingbirdCoreXCT into HummingbirdXCT

This PR includes #315 so it is probably best to review that first.

@adam-fowler adam-fowler requested a review from Joannis December 20, 2023 09:47
@adam-fowler adam-fowler changed the title Add AsyncHTTPClient testing setup 2.x.x - Add AsyncHTTPClient testing setup Dec 20, 2023
Copy link

github-actions bot commented Dec 20, 2023

Copy link

codecov bot commented Dec 20, 2023

Codecov Report

Attention: 88 lines in your changes are missing coverage. Please review.

Comparison is base (ec6049d) 84.48% compared to head (c9ee787) 83.26%.

Files Patch % Lines
Sources/HummingbirdXCT/HBXCTAsyncHTTPClient.swift 50.60% 81 Missing ⚠️
Sources/HummingbirdXCT/HBXCTLive.swift 72.72% 3 Missing ⚠️
Sources/HummingbirdXCT/TestApplication.swift 91.89% 3 Missing ⚠️
Sources/Hummingbird/Codable/CodableProtocols.swift 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            2.x.x     #317      +/-   ##
==========================================
- Coverage   84.48%   83.26%   -1.23%     
==========================================
  Files          82       84       +2     
  Lines        4532     4703     +171     
==========================================
+ Hits         3829     3916      +87     
- Misses        703      787      +84     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -76,7 +43,7 @@ final class HBXCTLive<App: HBApplicationProtocol>: HBXCTApplication {
}

init(app: App) {
self.timeout = .seconds(15)
self.timeout = .seconds(20)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason for this change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a test that had an AWS request in it which was timing out. I never got the AWS timeout because the client timed out. I should probably make this configurable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add Issue #318

@adam-fowler adam-fowler merged commit 096df59 into 2.x.x Dec 21, 2023
2 of 5 checks passed
@adam-fowler adam-fowler deleted the xct-ahc branch December 21, 2023 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants