-
Notifications
You must be signed in to change notification settings - Fork 44
Add integ test for http server #101
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
base: master
Are you sure you want to change the base?
Conversation
cc @henrybear327, @ivanvc and @ArkaSaha30 for comments |
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.
Thanks for the pull request, @bhuber, and for asking me to review this. I'm not very familiar with gofail's codebase. However, I read and executed the code locally to check the integration test. I left a couple of comments. Thanks again, Bennet.
@@ -0,0 +1,28 @@ | |||
package failpoints | |||
|
|||
func ExampleFunc() string { |
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.
Are these functions intentionally named with the Example
prefix so they appear in the godoc? If not, renaming them may be a good idea to avoid confusion.
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 copied these from https://github.com/etcd-io/gofail/blob/master/examples/examples.go , so felt it best to remain consistent as much as possible. It's definitely worth adding a comment to explain that. I'll do that before merging, but hold off for now in case there's more to change.
$ curl http://127.0.0.1:1234/SomeFuncString=return("hello") | ||
$ curl http://127.0.0.1:1234/SomeFuncString |
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.
Should we still keep the documentation for a single endpoint? Maybe push this example before activating the multiple endpoints?
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.
This isn't removing the documentation for a single endpoint, it's fixing it. The previous URL was nonsensical (why would you try to assign a return("hello")
value in the same operation that's listing current values?) and returns an error at runtime
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.
After re-examining the readme, I've just realized the "get all failpoint values" API isn't documented here ("listall" in server_test.go", so that's definitely worth adding. Maybe that's what you were referring to?
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.
This isn't removing the documentation for a single endpoint, it's fixing it. The previous URL was nonsensical (why would you try to assign a
return("hello")
value in the same operation that's listing current values?) and returns an error at runtime
I got it, it makes sense. Thanks for the clarification.
After re-examining the readme, I've just realized the "get all failpoint values" API isn't documented here ("listall" in server_test.go", so that's definitely worth adding. Maybe that's what you were referring to?
Unfortunately, as I said, I'm not an expert on this code base. So, I read the documentation as an end user and was confused. Thanks for the clarification. I would suggest to do this in a follow-up PR :)
Thanks for taking the time to read it, I know it's a bit lengthy! Replied to your comments, hoping for more feedback before making changes, as they're pretty minor. |
This fixes etcd-io#40 Signed-off-by: Bennet Huber <[email protected]>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: bhuber The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
I made the changes requested, but squashed into the previous commit, so they unfortunately can't be easily compared. I'm not entirely sure what the best workflow here is. On the one hand, it looks like this project really prefers one signed-off commit per PR, so merges need to be squashed and signed somehow. On the other, this makes comparing revisions within a PR very difficult for reviewers. I'm open to any suggestions for how to handle this in the future. The changes are quite small, for your convenience here's the entirety of them since the last version: https://gist.github.com/bhuber/cbf4a366fb63a6689bfb15619d637132 |
Squashing is fine :) Thanks for addressing my comments, @bhuber! I'd like to invoke @henrybear327, as he's more familiar with the code base and the integration tests. However, I know he's busy with some work related to the v3.6.0 release in the etcd repository. So, it may take some time until he can take a look at your pull request. |
/ok-to-test Edit: This repository's |
Gentle bump - it's been over a week since last update |
|
||
go 1.23 | ||
|
||
toolchain go1.23.6 |
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.
We might want to bump this to align with the latest go version update!
Overview
This fixes #40 , hopefully satisfactorily. The intent here is to make a generic and flexible test harness for exercising the gofail http api. I've added some obvious basic tests; I'm sure the maintainers can think of more to add in the future. I also fixed several inaccuracies in the documentation, and added a few missing pieces I found during the course of implementation.
The code should be pretty self explanatory. The main explanation of the test setup is in the godoc for
TestAll
in integration/server/server_test.go .This is my first PR to this repo, and I did my best to follow all the contribution instructions I could find, but please let me know if I missed anything.
Testing
make run-all-integration-tests
works locally