lausser / GLPlugin

Perl modules providing the basis for my Naemon plugins
15 stars 28 forks source link

Unit Test Failure in t/04-extra-opts.t #27

Open bgeels opened 3 years ago

bgeels commented 3 years ago

Hi,

I'm attempting to build this module and am hitting an error in the t/04-extra-opts.t test. As far as I can tell, it's failing because it can not open a file, t/etc/mysql-dbs.ini, due to this line:

https://github.com/lausser/GLPlugin/blob/master/t/04-extra-opts.t#L17

Any help you could provide resolving this issue would be appreciated, full output of make test included below.

Operating System:

CentOS Linux release 7.6.1810 (Core) 

Perl Version:

This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux-thread-multi

Make Test Output

$ make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00-load.t ......... 1/? # Testing Monitoring::GLPlugin 3.3.3.3, Perl 5.016003, /usr/bin/perl
t/00-load.t ......... ok   
t/01-new.t .......... 1/4 # 01-new.t
# /tmp
# /tmp/device::uptime
# 01-new.t
# undef
Use of uninitialized value in sprintf at /tmp/GLPlugin/blib/lib/Monitoring/GLPlugin.pm line 1412.
# /device::uptime
t/01-new.t .......... ok   
t/02-valdiff.t ...... 1/54 # statefile is /tmp/device::uptime_test
# now test ever growing metrics. shrinking means overrun
# now test growing and shrinking metrics
t/02-valdiff.t ...... 8/54 # delta -5
# now test growing and shrinking metrics, compare to a value in the past
t/02-valdiff.t ...... 11/54 # suddenly count is only 5
# delta -5 must be the result for the next 10 seconds
t/02-valdiff.t ...... 14/54 # after 12s delta is 0
# now test growing and shrinking metrics
# now test growing and shrinking lists
t/02-valdiff.t ...... 19/54 # delta -2
t/02-valdiff.t ...... 26/54 # delta 0
# now test growing and shrinking metrics, compare to a value in the past
# now test growing and shrinking lists, compare to a list in the past
t/02-valdiff.t ...... 43/54 # state change, ELEM4 and ELEM5 lost
t/02-valdiff.t ...... 46/54 # should still be the same
t/02-valdiff.t ...... 52/54 # after 12s delta is 0
t/02-valdiff.t ...... ok     
t/03-environment.t .. Use of uninitialized value $ENV{"TZ"} in concatenation (.) or string at t/03-environment.t line 18.
t/03-environment.t .. ok   
t/04-extra-opts.t ... 1/1 # Looks like your test exited with 3 just after 1.
t/04-extra-opts.t ... Dubious, test returned 3 (wstat 768, 0x300)
All 1 subtests passed 
t/10-snmp.t ......... Name "Monitoring::GLPlugin::pluginname" used only once: possible typo at t/10-snmp.t line 55.
t/10-snmp.t ......... 1/4 # 10-snmp.t
# /tmp
# /tmp/device::uptime
t/10-snmp.t ......... ok   
t/manifest.t ........ skipped: Author tests not required for installation
t/pod-coverage.t .... skipped: Author tests not required for installation
t/pod.t ............. skipped: Author tests not required for installation

Test Summary Report
-------------------
t/04-extra-opts.t (Wstat: 768 Tests: 1 Failed: 0)
  Non-zero exit status: 3
Files=9, Tests=70, 42 wallclock secs ( 0.05 usr  0.02 sys +  0.90 cusr  0.20 csys =  1.17 CPU)
Result: FAIL
Failed 1/9 test programs. 0/70 subtests failed.
make: *** [test_dynamic] Error 255
bgeels commented 3 years ago

After digging a little bit more it looks like the intention of this test was to override some cli options by specifying an .ini file. Creating a file like what's shown below in addition to modifying the test plan of the test to be plan tests => 7; allows the test to pass.

$ cat t/etc/mysql-dbs.ini 
method=mysql
hostname=wwwsrv8.naprax.de
password=pfu1de1fl
statefilesdir=/var/tmp/testtest
name=saxndi

I can add that if its omission was an oversight. Otherwise, if I'm overlooking a build step please let me know.

Thanks!

lausser commented 3 years ago

I just did the same and the test result is now ok

lausser@HULSE:~/git/GLPlugin$ PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/04-extra-opts.t

t/04-extra-opts.t .. 1/7 # /var/tmp/testtest

/var/tmp/testtest/device::uptime

module loaded

t/04-extra-opts.t .. ok

All tests successful.

Files=1, Tests=7, 0 wallclock secs ( 0.02 usr 0.05 sys + 0.07 cusr 0.14 csys = 0.28 CPU)

Result: PASS

lausser@HULSE:~/git/GLPlugin$

Von: Ben Geels [mailto:notifications@github.com] Gesendet: Dienstag, 9. März 2021 21:01 An: lausser/GLPlugin GLPlugin@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Betreff: Re: [lausser/GLPlugin] Unit Test Failure in t/04-extra-opts.t (#27)

After digging a little bit more it looks like the intention of this test was to override some cli options by specifying an .ini file. Creating a file like what's shown below in addition to modifying the test plan of the test to be plan tests => 7; allows the test to pass.

$ cat t/etc/mysql-dbs.ini method=mysql hostname=wwwsrv8.naprax.de password=pfu1de1fl statefilesdir=/var/tmp/testtest name=saxndi

I can add that if its omission was an oversight. Otherwise, if I'm overlooking a build step please let me know.

Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lausser/GLPlugin/issues/27#issuecomment-794381095 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AABQSOFY5NWSXG5DJRQI44LTCZV5PANCNFSM4Y4J6WYA .

lausser commented 3 years ago

I just pushed, should be fixed now. This test was “work in progress” for several years I guess :)

Von: Ben Geels [mailto:notifications@github.com] Gesendet: Dienstag, 9. März 2021 21:01 An: lausser/GLPlugin GLPlugin@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Betreff: Re: [lausser/GLPlugin] Unit Test Failure in t/04-extra-opts.t (#27)

After digging a little bit more it looks like the intention of this test was to override some cli options by specifying an .ini file. Creating a file like what's shown below in addition to modifying the test plan of the test to be plan tests => 7; allows the test to pass.

$ cat t/etc/mysql-dbs.ini method=mysql hostname=wwwsrv8.naprax.de password=pfu1de1fl statefilesdir=/var/tmp/testtest name=saxndi

I can add that if its omission was an oversight. Otherwise, if I'm overlooking a build step please let me know.

Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lausser/GLPlugin/issues/27#issuecomment-794381095 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AABQSOFY5NWSXG5DJRQI44LTCZV5PANCNFSM4Y4J6WYA .

bgeels commented 3 years ago

Ha gotcha, thanks for quick response!