Skip to content

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

bhuber
Copy link

@bhuber bhuber commented Feb 13, 2025

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

@ahrtr
Copy link
Member

ahrtr commented Feb 14, 2025

cc @henrybear327, @ivanvc and @ArkaSaha30 for comments

Copy link
Member

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

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.

Copy link
Author

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.

Comment on lines -86 to +97
$ curl http://127.0.0.1:1234/SomeFuncString=return("hello")
$ curl http://127.0.0.1:1234/SomeFuncString
Copy link
Member

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?

Copy link
Author

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

Copy link
Author

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?

Copy link
Member

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

@bhuber
Copy link
Author

bhuber commented Feb 21, 2025

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.

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]>
@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: bhuber
Once this PR has been reviewed and has the lgtm label, please ask for approval from ahrtr. For more information see the Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@bhuber
Copy link
Author

bhuber commented Feb 22, 2025

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

@ivanvc
Copy link
Member

ivanvc commented Feb 22, 2025

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.

@ivanvc
Copy link
Member

ivanvc commented Feb 22, 2025

/ok-to-test

Edit: This repository's /ok-to-test workflow is missing. We need a maintainer to approve the workflows manually.

@bhuber
Copy link
Author

bhuber commented Mar 4, 2025

Gentle bump - it's been over a week since last update


go 1.23

toolchain go1.23.6
Copy link
Contributor

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Add e2e test
5 participants