http-useragent icon indicating copy to clipboard operation
http-useragent copied to clipboard

Some tests still try to use the network even when NETWORK_TESTING is not set

Open zoffixznet opened this issue 7 years ago • 3 comments

Spotted this in a travis run:

[...]
# NETWORK_TESTING was not set
t/200-w3-test-encodings.t .. ok
t/210-content-encoding.t ... ok
t/220-binary-content.t ..... ok
t/230-binary-request.t ..... ok
    # Failed test 'right exception type (HTTP::UserAgent::Exception::X::HTTP::Internal)'
    # at /home/travis/.rakudobrew/moar-master/install/share/perl6/precomp/BE65026BFB5249C3382F8EDFB81A28020AC84608.1514511444.50491/C7/C712FE6969F786C9380D643DF17E85D06868219E line 1
    # Expected: HTTP::UserAgent::Exception::X::HTTP::Internal
    # Got:      X::AdHoc
    # Exception message: Could not connect socket: Connection refused
    # Looks like you failed 1 test of 3
# Failed test 'throws the correct exception'
# at t/250-issue-144.t line 28
# Looks like you failed 1 test of 1
t/250-issue-144.t .......... 
[...]

zoffixznet avatar Dec 29 '17 17:12 zoffixznet

This breaks CI for other modules using HTTP::UserAgent: https://travis-ci.org/bbkr/jsonrpc/jobs/351673499 .

bbkr avatar Mar 10 '18 17:03 bbkr

Assuming I'm reading the code correctly, NETWORK_TESTING is a red herring. This problem has nothing to do with that.

I am running into this here: https://travis-ci.org/zostay/Amazon-DynamoDB/jobs/412756488

Looking at how the server is startup, my guess is that there's either a problem with how the test selects an available port or the timing. I suspect a timing issue. Since the server is running in a separate thread, it does not appear to be the case that the code guarantees that the server is running before it tries to contact it.

zostay avatar Aug 06 '18 18:08 zostay

Looking through the build history of HTTP::UserAgent, the error occurs there too. For example,

https://travis-ci.org/sergot/http-useragent/builds/341064491

zostay avatar Aug 06 '18 18:08 zostay