go-httpclient icon indicating copy to clipboard operation
go-httpclient copied to clipboard

Intermittent TestHttpsConnection Failures to httpbin.org

Open fujin opened this issue 11 years ago • 6 comments

Hiya!

We use a copy of go-httpclient in one of our internal applications, but occasionally see a weird test failure

=== RUN TestHttpsConnection
--- FAIL: TestHttpsConnection (3.00 seconds)
    httpclient_test.go:93: 1st request failed - Get https://httpbin.org/ip: read tcp 23.21.162.118:443: use of closed network connection
=== RUN TestHttpClient
--- PASS: TestHttpClient (0.45 seconds)
=== RUN TestSlowServer
--- PASS: TestSlowServer (0.50 seconds)
=== RUN TestMultipleRequests
--- PASS: TestMultipleRequests (2.00 seconds)
FAIL
FAIL    github.com/mreiferson/go-httpclient 5.965s

Have you seen this before, is it a known issue? :metal:

fujin avatar Sep 05 '14 21:09 fujin

that test depends on an external service, unfortunately

mreiferson avatar Sep 05 '14 22:09 mreiferson

@mreiferson would it be possible to use a snakeoil certificate and local loopback https listener which returns the ipaddress of the request instead of relying on an external service?

fujin avatar Sep 10 '14 19:09 fujin

@fujin absolutely, if you're willing/interested in submitting a PR that would be awesome!

mreiferson avatar Sep 10 '14 19:09 mreiferson

@mreiferson I shall do so. Do you have any preference for the snakeoil certs or shall I just generate a pair?

fujin avatar Sep 10 '14 19:09 fujin

no preference, generating them sounds fine

mreiferson avatar Sep 10 '14 19:09 mreiferson

Who the hell would write tests depending on external servers that we have no control of?!

ducks for cover

mynameisfiber avatar Sep 12 '14 19:09 mynameisfiber