-
Notifications
You must be signed in to change notification settings - Fork 33
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
Refactor http handlers and instrument graceful shutdown #139
Refactor http handlers and instrument graceful shutdown #139
Conversation
e670bf0
to
0041484
Compare
fd8aba6
to
682f4d6
Compare
Codecov Report
@@ Coverage Diff @@
## main #139 +/- ##
==========================================
- Coverage 20.68% 20.19% -0.49%
==========================================
Files 7 11 +4
Lines 672 703 +31
==========================================
+ Hits 139 142 +3
- Misses 514 540 +26
- Partials 19 21 +2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
a9f4d48
to
532763c
Compare
Signed-off-by: Chris Doherty <[email protected]>
532763c
to
fd3eeb5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i like the clear and understandability of this! thanks!
@Mergifyio queue |
✅ The pull request has been merged manuallyThe pull request has been merged manually at 1aafdbe |
This change set seeks to separate HTTP handler configuration from HTTP server configuration and serving. Separating the handlers from the server that serves the endpoints makes the endpoint testing much easier as it doesn't require real HTTP server's, therefore no port juggling.
To create a better separation the following changes were made:
handler
package with a single API:New
. TheNew
function constructs the endpoints that need exposing based on a parameter. This facilitates the Hegel API that was under development.main
func.main
func.http.Serve
is still called frommain
but no longer launched in a separate goroutine.http.Serve
now facilitates proper graceful shutdown.A suite of tests have been deleted that were targetting internal APIs. When evaluating the tests it became evident that they weren't really testing anything useful as we had to construct the application in a consistent way for the tests to be useful. Additional handler tests will be written and placed in
ec2_test.go
or wherever that lands.Similarly, some tests that were valuable, namely the XFF tests, were re-written and moved to the
XFF
package. The tests are much more thorough in establishing expected XFF middleware behavior.Next steps
#143 begins the process of further splitting apart handlers and removing the ambiguity created from the 'export' concept in the backend implementations. This may result in a further separation of packages as #143 indicates with its
/internal/http/ec2
package.