Skip to content
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.

Commit

Permalink
Removing timeout hack, changing tests instead
Browse files Browse the repository at this point in the history
  • Loading branch information
crufter committed Oct 24, 2019
1 parent d6399d4 commit 04192bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 0 additions & 6 deletions pkg/kedge/http/lbtransport/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"io"
"net"
"net/http"
"strings"
"sync"

http_ctxtags "github.com/improbable-eng/go-httpwares/tags"
Expand Down Expand Up @@ -176,11 +175,6 @@ func isDialError(err error) bool {
return true
}
}
// On Windows dialing localhost seems to be slow so we don't get back a "dial" error like above
// See https://github.com/golang/go/issues/23366
if strings.Contains(err.Error(), "request canceled while waiting for connection") {
return true
}
return false
}

Expand Down
8 changes: 6 additions & 2 deletions pkg/kedge/http/lbtransport/transport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ func (s *BalancedRRTransportSuite) TestSrvLbErrorsNoResolution() {
func (s *BalancedRRTransportSuite) TestSrvLbErrorsAllResolvedAddressesAreWrong() {
// Add 5 not accessible backends.
backends := []*httptest.Server{}
for i := 0; i < 5; i++ {
numberOfBackends := 5
for i := 0; i < numberOfBackends; i++ {
b := httptest.NewUnstartedServer(nil)
// Don't even listen on socket - we want dial to fail immediately.
b.Close()
Expand All @@ -262,7 +263,10 @@ func (s *BalancedRRTransportSuite) TestSrvLbErrorsAllResolvedAddressesAreWrong()
// No backends.
s.backendSRVWatcher.UpdateBackends(backends)
s.waitForSRVPropagation(backends, 1*time.Second)
client := &http.Client{Transport: s.lbTrans, Timeout: 1 * time.Second}
// On Windows dialing a not open port on localhost seems to take about a second,
// hence the long Client timeout
// See https://github.com/golang/go/issues/23366
client := &http.Client{Transport: s.lbTrans, Timeout: time.Duration(numberOfBackends+1) * time.Second}
req, err := http.NewRequest("GET", "http://my-magic-srv/something", nil)
s.Require().NoError(err)

Expand Down

0 comments on commit 04192bc

Please sign in to comment.