abeltje / Test-Smoke

The Perl5 Core Smoke framework
6 stars 15 forks source link

Cache `$daemon->sockhost` in t/poster-post.t #63

Closed bram-perl closed 2 years ago

bram-perl commented 2 years ago

On my Windows 10 system 't/poster-post.t' was stuck. Debugging showed that this apparently happened when it tried to get the value of $daemon->sockhost for the test with 'HTTP::Tiny'.

Earlier calls for $daemon->sockhost (for the curl test) did succeed and did behave as expected...

Sample output of a run that was stuck:

# HTTP::Daemon (6.12): IPv6 (::1)
# Temporary daemon at: http://[::1]:57965/
ok 1 - An object of class 'Test::Smoke::Poster::LWP_UserAgent' isa 'Test::Smoke::Poster::LWP_UserAgent'
ok 2 - write_json
[2022-08-18 16:47:15Z] Posting to http://[::1]:57965/report via LWP::UserAgent.
[2022-08-18 16:47:15Z] Reading from (C:\Perl\Test-Smoke\t\testsuite.jsn)
[2022-08-18 16:47:15Z] Report data: {"sysinfo":"MSWin32"}
[2022-08-18 16:47:15Z] [CoreSmokeDB] {"id":42}
ok 3 - Got id (LWP::Useragent: http://[::1]:57965/report)
ok 4 - An object of class 'Test::Smoke::Poster::Curl' isa 'Test::Smoke::Poster::Curl'
ok 5 - write_json
[2022-08-18 16:47:15Z] Posting to "http://[::1]:57965/report" via curl.
[2022-08-18 16:47:15Z] Reading from (C:\Perl\Test-Smoke\t\testsuite.jsn)
[2022-08-18 16:47:15Z] Report data: {"sysinfo":"MSWin32"}
[2022-08-18 16:47:15Z] In pwd(C:/Perl/Test-Smoke) running:
[2022-08-18 16:47:15Z] qx[C:\Windows\system32\curl.EXE --globoff -A "Test::Smoke/1.79_01 (Test::Smoke::Poster::Curl)" -d json=%7B%22sysinfo%22%3A%22MSWin32%22%7D "http://[::1]:57965/report"]
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    49  100     9  100    40    522   2322 --:--:-- --:--:-- --:--:--  3062
[2022-08-18 16:47:15Z] [CoreSmokeDB] {"id":42}
ok 6 - Got id (curl: http://[::1]:57965/report)

And then it kept on waiting.. Caching the value of $daemon->sockhost appears to fix it.. (I've got no idea why tho)

With this patch applied and re-running the test it continues:

ok 7 - An object of class 'Test::Smoke::Poster::HTTP_Tiny' isa 'Test::Smoke::Poster::HTTP_Tiny'
ok 8 - write_json
[2022-08-18 16:56:15Z] Posting to http://[::1]:57990/report via HTTP::Tiny.
[2022-08-18 16:56:15Z] Reading from (C:\Perl\Test-Smoke\t\testsuite.jsn)
[2022-08-18 16:56:15Z] Report data: {"sysinfo":"MSWin32"}
[2022-08-18 16:56:15Z] [CoreSmokeDB] {"id":42}
ok 9 - Got id (HTTP::Tiny: http://[::1]:57990/report
ok 10 - no warnings
1..10