Skip Menu |

This queue is for tickets about the Rstat-Client CPAN distribution.

Report information
The Basics
Id: 109975
Status: rejected
Priority: 0/
Queue: Rstat-Client

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.2
Fixed in: (no value)



Subject: 3rd test fails
On most systems the test script fails: PERL_DL_NONLAZY=1 "/usr/perl5.18.4p/bin/perl5.18.4" "-Iblib/lib" "-Iblib/arch" test.pl 1..4 ok 1 ok 2 not ok 3 ok 4 (/usr/bin/make test exited with 0) The CPAN Testers Matrix is misleading here --- because "make test" exits with a zero exit code it looks like a PASS to CPAN::Reporter.
Thank you for your bug report. This is actually the expected result though. Rstat::Client is a client module for querying a remote rstatd. It would be nice for the test suite to make a query to confirm that everything is working... but where can it expect to find a running rstatd? There's no answer that will work in every environment, so it looks for one on localhost. If this fails, how do you distinguish between (a) rstatd doesn't happen to be running on localhost, and (b) rstatd is running but there's something wrong with the module? I asked this question on cpan-testers before releasing the module, and their suggestion was for this failure not to be fatal. Given the simplicity of the module, any runtime failure is likely to be caused by rstatd not running, and it would be misleading to fill the test history up with FAIL results for this reason. So if test 3 is the only one that fails, then the test suite will still pass. It would probably be nice to show a message in this case, so that if anyone is looking at the test output, they understand what's happening. Please let me know if you have any issues using the module!
On 2015-12-01 10:29:33, ISAACSON wrote: Show quoted text
> Thank you for your bug report. This is actually the expected result > though. > > Rstat::Client is a client module for querying a remote rstatd. It > would be nice for the test suite to make a query to confirm that > everything is working... but where can it expect to find a running > rstatd? > > There's no answer that will work in every environment, so it looks for > one on localhost. If this fails, how do you distinguish between (a) > rstatd doesn't happen to be running on localhost, and (b) rstatd is > running but there's something wrong with the module? > > I asked this question on cpan-testers before releasing the module, and > their suggestion was for this failure not to be fatal. Given the > simplicity of the module, any runtime failure is likely to be caused > by rstatd not running, and it would be misleading to fill the test > history up with FAIL results for this reason. So if test 3 is the only > one that fails, then the test suite will still pass.
There are possibilities to express such things in the TAP protocol. For example, you can mark this test case as a TODO test --- maybe you find a way to check for the existence of a running rstatd to make the test more reliable. If you're using Test::More then you can do it like this: { local $TODO = "May fail if there's no rstatd daemon running"; ok connect_to_rstatd(), "check rstatd connection"; } Or you could just skip things: SKIP: { skip "Probably no rstatd daemon running", 1 if !connect_to_rstatd(); ... another test using rstatd ... } Or just print some diagnostic message: if (!connect_to_rstatd()) { diag 'Can't connect to rstatd, maybe the daemon is not running'; } else { pass 'connect to rstatd'; } Additionally you can make it possible (e.g. through the use of environment variables) to make such a failure fatal for users who know that they are running a rstatd daemon. In any case you should check the other RT ticket about converting the test.pl script into a "modern" t/*.t script. Show quoted text
> > It would probably be nice to show a message in this case, so that if > anyone is looking at the test output, they understand what's > happening. > > Please let me know if you have any issues using the module!
Well, actually I am not a user of the module, but stumbled over random test failures in Rstat-Client while checking for possible regressions in newer perl versions (5.22.1, 5.23.5). See http://matrix.cpantesters.org/?dist=Rstat-Client%202.2 for the list of failures. I think the fails happen because the tests are hanging.