-
Notifications
You must be signed in to change notification settings - Fork 350
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
feat: /quitquitquit api now responds to HTTP GET and POST requests. #1947
Conversation
cmd/root_test.go
Outdated
@@ -1307,7 +1307,7 @@ func TestPProfServer(t *testing.T) { | |||
} | |||
} | |||
|
|||
func TestQuitQuitQuit(t *testing.T) { | |||
func TestQuitQuitQuitHttpPost(t *testing.T) { |
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.
HTTP
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.
Fixed.
cmd/root_test.go
Outdated
c := NewCommand(WithDialer(&spyDialer{})) | ||
c.SilenceUsage = true | ||
c.SilenceErrors = true | ||
c.SetArgs([]string{"--quitquitquit", "--admin-port", "9192", "my-project:my-region:my-instance"}) |
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.
Let's use 9193 or some other port to avoid conflicts with the test above.
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.
Fixed.
cmd/root_test.go
Outdated
@@ -1348,6 +1348,41 @@ func TestQuitQuitQuit(t *testing.T) { | |||
} | |||
} | |||
|
|||
func TestQuitQuitQuitHttpGet(t *testing.T) { |
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.
HTTP
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.
Fixed.
cmd/root_test.go
Outdated
errCh <- err | ||
}() | ||
|
||
resp, err := tryDial("GET", "http://localhost:9192/quitquitquit") |
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.
Maybe we pull the port out as a constant to avoid this kind of mistake (9192 here, 9193 above)
The /quitquitquit endpoint used to return a 400 error when it received a request other than an HTTP POST. Now, it
will shut down the proxy if it receives either a GET or a POST request. This will make it possible for kubernetes
pod lifecycle handlers to gracefully signal the proxy to shut down.
Fixes #1946