-
Notifications
You must be signed in to change notification settings - Fork 813
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
Added check for empty healthcheck post-body #2288
Added check for empty healthcheck post-body #2288
Conversation
/assign @roberthbailey |
Build Failed 😱 Build Id: 5c75da81-b9be-452e-a6af-35073e2f161b To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
I've created #2289 to fix this failing test. |
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.
Clever! I was wondering how we would solve this one, since it's all generated code!
Build Succeeded 👏 Build Id: 2085d9c8-d203-4204-8366-208dc90802bb The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
pkg/util/https/https.go
Outdated
@@ -66,3 +66,15 @@ func LogRequest(logger *logrus.Entry, r *http.Request) *logrus.Entry { | |||
WithField("headers", r.Header). | |||
WithField("requestURI", r.RequestURI) | |||
} | |||
|
|||
// RequestWrapper perform checks on request | |||
func RequestWrapper(h http.Handler) http.Handler { |
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 might have been a bit quick to approve - I think this could go into main.go / move into th sdk package - since it's not a generic https utility that's used across the project.
But still like the approach!
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.
+1
What about just making this a function in cmd/sdk-server/main.go
called something like func healthcheckWrapper(...)
(not exported outside of that main pkg)?
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.
+1
@roberthbailey I agree with you.
We can put the wrapper function in cmd/sdk-server/main.go
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.
Sounds great. Let me know once it's ready for review, and we can try to get it merged before the release candidate tomorrow.
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 have made the suggested changes, but build is failing.
03fb25d
to
01aed16
Compare
Build Failed 😱 Build Id: 3fa132df-99c6-4371-8857-7144cc619a44 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Failed 😱 Build Id: 0a32fd4d-6b34-4fc3-ae9c-809d3fe19efd To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Failed 😱 Build Id: 99616cf7-e5aa-4785-a49c-c560e20e3a8e To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Failed 😱 Build Id: 1c7cf5e0-4c77-4827-9fe5-1f92a2579a86 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
@roberthbailey I was not able to figure out if build failed because of my changes? |
I was hoping to get this in before the release candidate yesterday so I re-ran the e2e tests a few times. Since they did not pass I was not able to merge it. The tests failed with different reasons (some of which were unrelated to your change) but if I look at the last two failures it seems like it was likely caused by this change. One had this failure:
and I also saw this in a different run:
|
Maybe you can trigger the build again to see if it passes. |
I'll update the branch which will give it another chance to run. |
Build Failed 😱 Build Id: 9ca5715a-443c-4693-bbd5-2879e61f2aaa To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Succeeded 👏 Build Id: 58316eb7-4561-42f0-8b75-bf3011ef4bdd The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
cmd/sdk-server/main.go
Outdated
@@ -318,3 +318,15 @@ type config struct { | |||
GRPCPort int | |||
HTTPPort int | |||
} | |||
|
|||
// healthCheckWrapper perform checks on request |
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.
LGTM. Do we need some kind of unit test here though? I'm leaning towards yes, just to make sure it's always doing what we expect.
We have main_test.go already, which would be a good spot for the unit test.
@roberthbailey wdyt?
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.
@markmandel I have added a test for healthCheckWrapper
.
Please have a look.
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.
Thank you for adding test coverage!
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.
nit: What about "healthCheckWrapper ensures that an http 400 response is returned if the healthcheck receives a request with an empty post body."
4c9e667
to
4e50adc
Compare
Build Failed 😱 Build Id: efba6070-808e-4916-8515-353bc54134a9 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
cmd/sdk-server/main.go
Outdated
@@ -318,3 +318,15 @@ type config struct { | |||
GRPCPort int | |||
HTTPPort int | |||
} | |||
|
|||
// healthCheckWrapper perform checks on request |
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.
nit: What about "healthCheckWrapper ensures that an http 400 response is returned if the healthcheck receives a request with an empty post body."
4e50adc
to
bc22b59
Compare
Build Failed 😱 Build Id: a623b346-7b16-4492-8965-b44cff7d6aee To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Signed-off-by: Sankalp Rangare <sankalprangare786@gmail.com>
bc22b59
to
fa948b3
Compare
Build Failed 😱 Build Id: f60cdbf5-132c-4733-99d9-2b971b7cf4dc To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Succeeded 👏 Build Id: 6e871de0-a81c-43a1-a3a7-ff0510acc0f9 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
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.
Any other comments @markmandel before I merge this?
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.
LGTM!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: markmandel, roberthbailey, sankalp-r The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
Which issue(s) this PR fixes:
Closes #2256