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

fix flaky test #2513

Merged
merged 1 commit into from
Aug 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion filters/tee/tee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/zalando/skipper/eskip"
"github.com/zalando/skipper/filters"
"github.com/zalando/skipper/filters/filtertest"
"github.com/zalando/skipper/net"
"github.com/zalando/skipper/proxy/proxytest"
"github.com/zalando/skipper/routing"
"github.com/zalando/skipper/routing/testdataclient"
Expand Down Expand Up @@ -255,7 +256,9 @@ func TestTeeEndToEndBody2TeeRoutesAndClosing(t *testing.T) {

req.Host = "www.example.org"
req.Close = true
rsp, err := (&http.Client{}).Do(req)
rt := net.NewTransport(net.Options{})
defer rt.Close()
rsp, err := rt.RoundTrip(req)
Comment on lines +259 to +261
Copy link
Member

Choose a reason for hiding this comment

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

You should use proxy.Client() which is https://pkg.go.dev/net/http/httptest#Server.Client

Copy link
Member Author

Choose a reason for hiding this comment

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

Why?

Copy link
Member

Choose a reason for hiding this comment

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

I think I misunderstood the problem this is fixing.

http client can sometimes create more than one request

Maybe its worth expanding when this can happen and how it is related to the flaky test this fixes.

if err != nil {
t.Error(err)
}
Expand Down