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

Change e2e tests to bind on :0 instead of :8181 #1534

Merged
merged 1 commit into from
Jul 1, 2019

Conversation

patrick-east
Copy link
Contributor

@patrick-east patrick-east commented Jun 28, 2019

To do this we needed a way to get the actual address that was bound.
To do that we needed to refactor the server and runtime code a tad
to let us create our own net.Listeners and get their address after
they had been started. The code is pretty much 1:1 with what is in the
official http package.

Now when the tests run using the helpers to stand up server runtimes
they should all be on separate ports.. in theory we could run the
unit tests in parallel without concern (for the e2e parts anyway).

Fixes: #1533
Signed-off-by: Patrick East east.patrick@gmail.com

To do this we needed a way to get the actual address that was bound.
To do that we needed to refactor the server and runtime code a tad
to let us create our own `net.Listener`s and get their address _after_
they had been started. The code is pretty much 1:1 with what is in the
official `http` package.

Now when the tests run using the helpers to stand up server runtimes
they should all be on separate ports.. in theory we could run the
unit tests in parallel without concern (for the e2e parts anyway).

Fixes: open-policy-agent#1533
Signed-off-by: Patrick East <east.patrick@gmail.com>
Copy link
Member

@ashutosh-narkar ashutosh-narkar left a comment

Choose a reason for hiding this comment

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

LGTM

return nil, err
}
tc.SetKeepAlive(true)
tc.SetKeepAlivePeriod(3 * time.Minute)
Copy link
Member

Choose a reason for hiding this comment

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

NIT: use a const for this instead of 3.

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 left it as-is to match https://golang.org/src/net/http/server.go?s=86961:87002#L3263 I figure the least amount of deviation the better.

@patrick-east patrick-east merged commit 97d8ebf into open-policy-agent:master Jul 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

e2e/logs test fails intermittently
2 participants