sergot / http-useragent

Web user agent class for Perl 6.
MIT License
36 stars 39 forks source link

Confusing test failures during installation if something else is already listening on port 3333 #158

Open vadz opened 7 years ago

vadz commented 7 years ago

I've just lost some trying to understand why I was getting many test failures during HTTP::UserAgent installation and it turns out that some tests (110, 230, 250) rely on being able to listen on port 3333. If there is something else listening there (my own HTTP server, that I'm actually installing HTTP::UserAgent to work for!), the tests fail but the reason for their failure is not clear at all.

It would be nice if they complained about failing to bind to the port instead of giving something like this (and plenty more):

    # Failed test 'got the right ct back'
    # at t/230-binary-request.t line 38
    # expected: 'application/octet-stream'
    #      got: ''

    # Failed test 'got binary response'
    # at t/230-binary-request.t line 39

    # Failed test 'and we got back what we sent'
    # at t/230-binary-request.t line 40
    # expected: '58'
    #      got: '1'

    # Failed test 'and buffer looks the same'
    # at t/230-binary-request.t line 41
    # Looks like you failed 4 tests of 11

If not, I hope this could at least be useful to someone getting the same errors in the future.

jonathanstowe commented 7 years ago

I had thought about this several times and immediately forgot. It's what I made the Test::Util::ServerPort for.

I'll do this when I get in :)

jonathanstowe commented 7 years ago

That should be sorted now, you may need to installdeps if you have a checkout.

vadz commented 7 years ago

Thanks for the fix!

I'm not sure if it's a real problem or not, but doing zef install HTTP::UserAgent now fails with:

===> Testing: HTTP::UserAgent:ver('1.1.25'):auth('github:sergot')
# NETWORK_TESTING was not set
===SORRY!===
Could not find Test::Util::ServerPort at line 7 in:
    /home/zeitlin/.zef/store/http-useragent.git/3c07fece7fce9a31ac1433d93283119c6d65c977/lib
    /home/zeitlin/.zef/store/perl6-http-status.git/20486489dfb9b3a81300e0ad068edf96855ba22b/lib
    /home/zeitlin/.zef/store/p6-File-Temp.git/11cf08f6a64aad19b9b60793200f212a8dcb48be/lib
    /home/zeitlin/.zef/store/p6-file-directory-tree.git/9970d80c0404f640eeda3c623c39a13496c9a0b2/lib
    /home/zeitlin/.zef/store/datetime-parse.git/3d3681e3dc290f294006e0861c1867922b4e677a/lib
    /home/zeitlin/.zef/store/perl6-encode.git/702214dcedd05ea62d815ffb4c287e1596cee4c9/lib
    /home/zeitlin/.zef/store/Perl6-MIME-Base64.git/32631a339f27489d86d7636bcba273b91b60aa81/lib
    /home/zeitlin/.zef/store/uri.git/7d3f8c185b86a99e1cbb8c4365dd370f23f4b4fd/lib
    /home/zeitlin/.zef/store/IO-Capture-Simple.git/cdbe43ed040adfd6a2abbc1a1e5b9f022ec210ab/lib
    /home/zeitlin/.perl6
    /usr/share/perl6/site
    /usr/share/perl6/vendor
    /usr/share/perl6
    CompUnit::Repository::AbsolutePath<94601004162064>
    CompUnit::Repository::NQP<94601004164320>
    CompUnit::Repository::Perl5<94601004164360>
...

It did work after a manual zef install Test::Util::ServerPort, but shouldn't it have been installed automatically? I do see it in test-depends in META.info, so it looks like it ought to work, but it definitely didn't work here...

jonathanstowe commented 7 years ago

No that is a problem, of course it is tricky to test when I already have Test::Util::ServerPort installed.

ugexe commented 7 years ago

I think this was a bug with zef using a cached copy of the previous install with the updated meta data fetched from the ecosystem. Will investigate.

ugexe commented 7 years ago

Er, I mean the other way around: it's fetching the updated module but using a cached meta file (which wouldn't have the additional dependency listed)