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

Added check for empty healthcheck post-body #2288

Merged
merged 2 commits into from
Oct 18, 2021

Conversation

sankalp-r
Copy link
Contributor

What type of PR is this?

Uncomment only one /kind <> line, press enter to put that in a new line, and remove leading whitespace from that line:

/kind breaking
/kind bug
/kind cleanup
/kind documentation

/kind feature

/kind hotfix

Which issue(s) this PR fixes:

Closes #2256

@sankalp-r
Copy link
Contributor Author

/assign @roberthbailey

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 5c75da81-b9be-452e-a6af-35073e2f161b

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@roberthbailey
Copy link
Member

I've created #2289 to fix this failing test.

Copy link
Member

@markmandel markmandel left a 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!

@agones-bot
Copy link
Collaborator

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:

  • git fetch https://github.com/googleforgames/agones.git pull/2288/head:pr_2288 && git checkout pr_2288
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.18.0-03fb25d

@@ -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 {
Copy link
Member

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!

Copy link
Member

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)?

Copy link
Contributor Author

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

Copy link
Member

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.

Copy link
Contributor Author

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.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 3fa132df-99c6-4371-8857-7144cc619a44

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 0a32fd4d-6b34-4fc3-ae9c-809d3fe19efd

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 99616cf7-e5aa-4785-a49c-c560e20e3a8e

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot
Copy link
Collaborator

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 roberthbailey added the feature-freeze-do-not-merge Only eligible to be merged once we are out of feature freeze (next full release) label Oct 5, 2021
@sankalp-r
Copy link
Contributor Author

@roberthbailey I was not able to figure out if build failed because of my changes?

@roberthbailey
Copy link
Member

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:

--- FAIL: TestFleetRecreateGameServers (0.01s)
    --- FAIL: TestFleetRecreateGameServers/gameserver_shutdown (79.61s)
        fleet_test.go:1199: 
            	Error Trace:	fleet_test.go:1199
            	Error:      	"[{{GameServer agones.dev/v1} {simple-fleet-c7g95-99lrs-2qbjd simple-fleet-c7g95-99lrs- 1633450298  df5595e7-3d36-4fdd-b6d8-63d51a1caf07 46450332 %!s(int64=6) 2021-10-05 16:15:15 +0000 UTC <nil> %!s(*int64=<nil>) map[agones.dev/fleet:simple-fleet-c7g95 agones.dev/gameserverset:simple-fleet-c7g95-99lrs] map[agones.dev/ready-container-id:containerd://831f55609e4839e7150fb30b67bb91d1e54f7ec5791f297c734ea1d5aec79091 agones.dev/sdk-version:1.18.0-e59725a] [...]" should have 10 item(s), but has 11
            	Test:       	TestFleetRecreateGameServers/gameserver_shutdown

and I also saw this in a different run:

E1005 17:20:37.640284 524 runtime.go:78] Observed a panic: "invalid memory address or nil pointer dereference" (runtime error: invalid memory address or nil pointer dereference)

@sankalp-r
Copy link
Contributor Author

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:

--- FAIL: TestFleetRecreateGameServers (0.01s)
    --- FAIL: TestFleetRecreateGameServers/gameserver_shutdown (79.61s)
        fleet_test.go:1199: 
            	Error Trace:	fleet_test.go:1199
            	Error:      	"[{{GameServer agones.dev/v1} {simple-fleet-c7g95-99lrs-2qbjd simple-fleet-c7g95-99lrs- 1633450298  df5595e7-3d36-4fdd-b6d8-63d51a1caf07 46450332 %!s(int64=6) 2021-10-05 16:15:15 +0000 UTC <nil> %!s(*int64=<nil>) map[agones.dev/fleet:simple-fleet-c7g95 agones.dev/gameserverset:simple-fleet-c7g95-99lrs] map[agones.dev/ready-container-id:containerd://831f55609e4839e7150fb30b67bb91d1e54f7ec5791f297c734ea1d5aec79091 agones.dev/sdk-version:1.18.0-e59725a] [...]" should have 10 item(s), but has 11
            	Test:       	TestFleetRecreateGameServers/gameserver_shutdown

and I also saw this in a different run:

E1005 17:20:37.640284 524 runtime.go:78] Observed a panic: "invalid memory address or nil pointer dereference" (runtime error: invalid memory address or nil pointer dereference)

Maybe you can trigger the build again to see if it passes.

@roberthbailey
Copy link
Member

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.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 9ca5715a-443c-4693-bbd5-2879e61f2aaa

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot
Copy link
Collaborator

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:

  • git fetch https://github.com/googleforgames/agones.git pull/2288/head:pr_2288 && git checkout pr_2288
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.18.0-4c9e667

@@ -318,3 +318,15 @@ type config struct {
GRPCPort int
HTTPPort int
}

// healthCheckWrapper perform checks on request
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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!

Copy link
Member

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."

@roberthbailey roberthbailey removed the feature-freeze-do-not-merge Only eligible to be merged once we are out of feature freeze (next full release) label Oct 12, 2021
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: efba6070-808e-4916-8515-353bc54134a9

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@@ -318,3 +318,15 @@ type config struct {
GRPCPort int
HTTPPort int
}

// healthCheckWrapper perform checks on request
Copy link
Member

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."

cmd/sdk-server/main_test.go Outdated Show resolved Hide resolved
@agones-bot
Copy link
Collaborator

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>
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: f60cdbf5-132c-4733-99d9-2b971b7cf4dc

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot
Copy link
Collaborator

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:

  • git fetch https://github.com/googleforgames/agones.git pull/2288/head:pr_2288 && git checkout pr_2288
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.19.0-3b20c1f

Copy link
Member

@roberthbailey roberthbailey left a 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?

Copy link
Member

@markmandel markmandel left a comment

Choose a reason for hiding this comment

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

LGTM!

@google-oss-robot
Copy link

[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:
  • OWNERS [markmandel,roberthbailey]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@markmandel markmandel merged commit 4968da9 into googleforgames:main Oct 18, 2021
@markmandel markmandel added this to the 1.19.0 milestone Oct 18, 2021
@markmandel markmandel added the kind/cleanup Refactoring code, fixing up documentation, etc label Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved cla: yes kind/cleanup Refactoring code, fixing up documentation, etc lgtm size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sidecar REST endpoint should return 400 if healthcheck body is empty
5 participants