Ubic icon indicating copy to clipboard operation
Ubic copied to clipboard

Tests should not use sudo privileges

Open ghost opened this issue 10 years ago • 0 comments

Hi,

I was trying to install Exobrain which depends on Ubic for services and was a little surprised to find failures over Ubic running tests requiring sudo privileges. Here's a snapshot of the logs:

==> Found dependencies: Ubic::Multiservice::Simple, Ubic::Service::SimpleDaemon, ZMQ, Ubic
Searching Ubic::Multiservice::Simple on cpanmetadb ...
--> Working on Ubic::Multiservice::Simple
Fetching http://www.cpan.org/authors/id/M/MM/MMCLERIC/Ubic-1.58.tar.gz
-> OK
Unpacking Ubic-1.58.tar.gz
Entering Ubic-1.58
Checking configure dependencies from META.yml
Checking if you have ExtUtils::MakeMaker 6.30 ... Yes (7.04)
Configuring Ubic-1.58
Running Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Ubic
Writing MYMETA.yml and MYMETA.json
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have Class::Accessor::Fast 0 ... Yes (0.34)
Checking if you have Config 0 ... Yes (5.018001)
Checking if you have IPC::Open3 0 ... Yes (1.13)
Checking if you have overload 0 ... Yes (1.22)
Checking if you have IO::Select 0 ... Yes (1.21)
Checking if you have List::MoreUtils 0 ... Yes (0.413)
Checking if you have Scalar::Util 0 ... Yes (1.42)
Checking if you have File::Copy 0 ... Yes (2.26)
Checking if you have Test::Class 0 ... Yes (0.50)
Checking if you have Params::Validate 0 ... Yes (1.21)
Checking if you have File::Basename 0 ... Yes (2.84)
Checking if you have IO::Handle 0 ... Yes (1.34)
Checking if you have Storable 0 ... Yes (2.41)
Checking if you have HTTP::Server::Simple::CGI 0 ... Yes (undef)
Checking if you have List::Util 0 ... Yes (1.42)
Checking if you have Cwd 0 ... Yes (3.47)
Checking if you have Try::Tiny 0 ... Yes (0.22)
Checking if you have Config::Tiny 0 ... Yes (2.23)
Checking if you have warnings 0 ... Yes (1.18)
Checking if you have JSON 0 ... Yes (2.90)
Checking if you have strict 0 ... Yes (1.07)
Checking if you have Term::ANSIColor 0 ... Yes (4.02)
Checking if you have POSIX 0 ... Yes (1.32)
Checking if you have parent 0 ... Yes (0.225)
Checking if you have Test::Fatal 0 ... Yes (0.014)
Checking if you have File::Which 0 ... Yes (1.19)
Checking if you have Test::More 0 ... Yes (1.001014)
Checking if you have File::Find 0 ... Yes (1.23)
Checking if you have File::Path 0 ... Yes (2.11)
Checking if you have Pod::Usage 0 ... Yes (1.61)
Checking if you have Carp 0 ... Yes (1.29)
Checking if you have Exporter 0 ... Yes (5.68)
Checking if you have IO::Socket 0 ... Yes (1.36)
Checking if you have Getopt::Long 2.33 ... Yes (2.47)
Checking if you have Data::Dumper 0 ... Yes (2.145)
Checking if you have File::Spec 0 ... Yes (3.47)
Checking if you have Time::HiRes 0 ... Yes (1.9726)
Checking if you have Fcntl 0 ... Yes (1.11)
Building and testing Ubic-1.58
cp lib/Ubic/Ping.pm blib/lib/Ubic/Ping.pm
cp lib/Ubic/Result.pm blib/lib/Ubic/Result.pm
cp lib/Ubic/ServiceLoader/Default.pm blib/lib/Ubic/ServiceLoader/Default.pm
cp lib/Ubic/Run.pm blib/lib/Ubic/Run.pm
cp lib/Ubic/Multiservice/Simple.pm blib/lib/Ubic/Multiservice/Simple.pm
cp lib/Ubic/Settings/ConfigFile.pm blib/lib/Ubic/Settings/ConfigFile.pm
cp lib/Ubic/Multiservice.pm blib/lib/Ubic/Multiservice.pm
cp lib/Ubic/Manual/FAQ.pod blib/lib/Ubic/Manual/FAQ.pod
cp lib/Ubic/Daemon/OS/Linux.pm blib/lib/Ubic/Daemon/OS/Linux.pm
cp lib/Ubic/Cmd.pm blib/lib/Ubic/Cmd.pm
cp lib/Ubic/ServiceLoader/Ext/ini.pm blib/lib/Ubic/ServiceLoader/Ext/ini.pm
cp lib/Ubic/ServiceLoader/Base.pm blib/lib/Ubic/ServiceLoader/Base.pm
cp lib/Ubic/Daemon/OS.pm blib/lib/Ubic/Daemon/OS.pm
cp lib/Ubic/AtomicFile.pm blib/lib/Ubic/AtomicFile.pm
cp lib/Ubic/Manual/Multiservices.pod blib/lib/Ubic/Manual/Multiservices.pod
cp lib/Ubic/Multiservice/Dir.pm blib/lib/Ubic/Multiservice/Dir.pm
cp lib/Ubic/Daemon/Status.pm blib/lib/Ubic/Daemon/Status.pm
cp lib/Ubic/Daemon/PidState.pm blib/lib/Ubic/Daemon/PidState.pm
cp lib/Ubic/Credentials.pm blib/lib/Ubic/Credentials.pm
cp lib/Ubic/ServiceLoader.pm blib/lib/Ubic/ServiceLoader.pm
cp lib/Ubic/Persistent.pm blib/lib/Ubic/Persistent.pm
cp lib/Ubic/ServiceLoader/Ext/json.pm blib/lib/Ubic/ServiceLoader/Ext/json.pm
cp lib/Ubic/Service/Utils.pm blib/lib/Ubic/Service/Utils.pm
cp lib/Ubic/Ping/Service.pm blib/lib/Ubic/Ping/Service.pm
cp lib/Ubic/Service/SimpleDaemon.pm blib/lib/Ubic/Service/SimpleDaemon.pm
cp lib/Ubic/Cmd/Results.pm blib/lib/Ubic/Cmd/Results.pm
cp lib/Ubic.pm blib/lib/Ubic.pm
cp lib/Ubic/AccessGuard.pm blib/lib/Ubic/AccessGuard.pm
cp lib/Ubic/Service.pm blib/lib/Ubic/Service.pm
cp lib/Ubic/Daemon/OS/POSIX.pm blib/lib/Ubic/Daemon/OS/POSIX.pm
cp lib/Ubic/Result/Class.pm blib/lib/Ubic/Result/Class.pm
cp lib/Ubic/Admin/Setup.pm blib/lib/Ubic/Admin/Setup.pm
cp lib/Ubic/Credentials/OS/MacOSX.pm blib/lib/Ubic/Credentials/OS/MacOSX.pm
cp lib/Ubic/Lockf/Alarm.pm blib/lib/Ubic/Lockf/Alarm.pm
cp lib/Ubic/Daemon.pm blib/lib/Ubic/Daemon.pm
cp lib/Ubic/Settings.pm blib/lib/Ubic/Settings.pm
cp lib/Ubic/Service/Skeleton.pm blib/lib/Ubic/Service/Skeleton.pm
cp lib/Ubic/Manual/Intro.pod blib/lib/Ubic/Manual/Intro.pod
cp lib/Ubic/Manual/Overview.pod blib/lib/Ubic/Manual/Overview.pod
cp lib/Ubic/PortMap.pm blib/lib/Ubic/PortMap.pm
cp lib/Ubic/Logger.pm blib/lib/Ubic/Logger.pm
cp lib/Ubic/Credentials/OS/POSIX.pm blib/lib/Ubic/Credentials/OS/POSIX.pm
cp lib/Ubic/Lockf.pm blib/lib/Ubic/Lockf.pm
cp lib/Ubic/Service/Common.pm blib/lib/Ubic/Service/Common.pm
cp lib/Ubic/Credentials/OS/Windows.pm blib/lib/Ubic/Credentials/OS/Windows.pm
cp lib/Ubic/SingletonLock.pm blib/lib/Ubic/SingletonLock.pm
cp lib/Ubic/UA.pm blib/lib/Ubic/UA.pm
cp lib/Ubic/Watchdog.pm blib/lib/Ubic/Watchdog.pm
cp bin/ubic blib/script/ubic
"/usr/bin/perl5.18.1" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/ubic
cp bin/ubic-daemon blib/script/ubic-daemon
"/usr/bin/perl5.18.1" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/ubic-daemon
cp bin/ubic-watchdog blib/script/ubic-watchdog
"/usr/bin/perl5.18.1" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/ubic-watchdog
cp bin/ubic-update blib/script/ubic-update
"/usr/bin/perl5.18.1" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/ubic-update
cp bin/ubic-periodic blib/script/ubic-periodic
"/usr/bin/perl5.18.1" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/ubic-periodic
cp bin/ubic-admin blib/script/ubic-admin
"/usr/bin/perl5.18.1" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/ubic-admin
Manifying 6 pod documents
Manifying 37 pod documents
Manifying 11 pod documents
PERL_DL_NONLAZY=1 "/usr/bin/perl5.18.1" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/loaders/*.t t/multiservice/*.t
t/00_compile.t ................. ok
t/author-memory-leak.t ......... skipped: these tests are for testing by the author
t/author-ping.t ................ skipped: these tests are for testing by the author

#   Failed test 'Ubic::Cmd logged something on start'
#   at t/cmd.t line 25.
#                   'Starting sleeping-daemon... Failed to set effective gid to 100 100: Operation not permitted at lib/Ubic/Credentials/OS/POSIX.pm line 246.
# '
#     doesn't match '(?^:^Starting\ sleeping\-daemon\.\.\.\ started\ \(pid\ \d+\)\n$)'
Failed to set effective gid to 100 100: Operation not permitted at lib/Ubic/Credentials/OS/POSIX.pm line 246.
# Looks like you planned 8 tests but ran 1.
# Looks like you failed 1 test of 1 run.
# Looks like your test exited with 255 just after 1.
t/cmd.t ........................ 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 8/8 subtests 
t/credentials.t ................ ok
t/daemon.t ..................... ok
t/loaders/default.t ............ ok
t/loaders/ini.t ................ ok
t/loaders/json.t ............... ok
t/loaders/loader-frontend.t .... ok
t/lock.t ....................... ok
t/logrotate.t .................. ok
t/multiservice/dir.t ........... ok
t/multiservice/simple-names.t .. ok
t/multiservice/simple.t ........ ok
t/pod.t ........................ ok
t/pod_coverage.t ............... skipped: Test::Pod::Coverage required for testing POD coverage
t/release-pod-coverage.t ....... skipped: these tests are for release candidate testing
t/release-pod-syntax.t ......... skipped: these tests are for release candidate testing
t/result.t ..................... ok

#   Failed test at t/run.t line 29.
#                   'Starting sleeping-daemon... Failed to set effective gid to 100 100: Operation not permitted at /home/vats/.cpanm/work/1449925581.7615/Ubic-1.58/lib/Ubic/Credentials/OS/POSIX.pm line 246.
# '
#     doesn't match '(?^:^Starting\ sleeping\-daemon\.\.\.\ started\ \(pid\ \d+\)$)'

#   Failed test 'Ubic::Run works, sleeping-daemon is running'
#   at t/run.t line 32.
#                   'sleeping-daemon    Failed to set effective gid to 100 100: Operation not permitted at /home/vats/.cpanm/work/1449925581.7615/Ubic-1.58/lib/Ubic/Credentials/OS/POSIX.pm line 246.
# '
#     doesn't match '(?^x:sleeping-daemon \s+ running)'

#   Failed test 'logrotate command implemented'
#   at t/run.t line 37.

#   Failed test at t/run.t line 29.
#                   'Starting sleeping-daemon... Failed to set effective gid to 100 100: Operation not permitted at /home/vats/.cpanm/work/1449925581.7615/Ubic-1.58/lib/Ubic/Credentials/OS/POSIX.pm line 246.
# '
#     doesn't match '(?^:^Starting\ sleeping\-daemon\.\.\.\ started\ \(pid\ \d+\)$)'

#   Failed test 'Ubic::Run works, sleeping-daemon is running'
#   at t/run.t line 32.
#                   'sleeping-daemon    Failed to set effective gid to 100 100: Operation not permitted at /home/vats/.cpanm/work/1449925581.7615/Ubic-1.58/lib/Ubic/Credentials/OS/POSIX.pm line 246.
# '
#     doesn't match '(?^x:sleeping-daemon \s+ running)'

#   Failed test 'logrotate command implemented'
#   at t/run.t line 37.

#   Failed test at t/run.t line 29.
#                   'Starting sleeping-daemon... Failed to set effective gid to 100 100: Operation not permitted at /home/vats/.cpanm/work/1449925581.7615/Ubic-1.58/lib/Ubic/Credentials/OS/POSIX.pm line 246.
# '
#     doesn't match '(?^:^Starting\ sleeping\-daemon\.\.\.\ started\ \(pid\ \d+\)$)'

#   Failed test 'Ubic::Run works, sleeping-daemon is running'
#   at t/run.t line 32.
#                   'sleeping-daemon    Failed to set effective gid to 100 100: Operation not permitted at /home/vats/.cpanm/work/1449925581.7615/Ubic-1.58/lib/Ubic/Credentials/OS/POSIX.pm line 246.
# '
#     doesn't match '(?^x:sleeping-daemon \s+ running)'

#   Failed test 'logrotate command implemented'
#   at t/run.t line 37.

#   Failed test 'status works for multiservice'
#   at t/run.t line 58.
#                   'Starting multi.sleep1... Failed to set effective gid to 100 100: Operation not permitted at /home/vats/.cpanm/work/1449925581.7615/Ubic-1.58/lib/Ubic/Credentials/OS/POSIX.pm line 246.
# Starting multi.sleep2... Failed to set effective gid to 100 100: Operation not permitted at /home/vats/.cpanm/work/1449925581.7615/Ubic-1.58/lib/Ubic/Credentials/OS/POSIX.pm line 246.
# '
#     doesn't match '(?^msx:
#     Starting \s+ multi\.sleep1\.\.\. \s+ started \s+ \(pid \s+ \d+\)\s+
#     Starting \s+ multi\.sleep2\.\.\. \s+ started \s+ \(pid \s+ \d+\)
#     )'

#   Failed test 'start init script with explicit service name'
#   at t/run.t line 67.
#                   'Starting sleeping-daemon... Failed to set effective gid to 100 100: Operation not permitted at /home/vats/.cpanm/work/1449925581.7615/Ubic-1.58/lib/Ubic/Credentials/OS/POSIX.pm line 246.
# '
#     doesn't match '(?^:^Starting\ sleeping\-daemon\.\.\.\ started\ \(pid\ \d+\)$)'
# Looks like you failed 11 tests of 20.
t/run.t ........................ 
Dubious, test returned 11 (wstat 2816, 0xb00)
Failed 11/20 subtests 
t/service.t .................... ok
t/setup.t ...................... ok
t/simple-daemon.t .............. ok
t/ubic-daemon-script.t ......... ok
t/ubic-script.t ................ ok

#   Failed test 'multiservices died (Failed to set effective gid to 100 100: Operation not permitted at lib/Ubic/Credentials/OS/POSIX.pm line 246.)'
#   at t/ubic.t line 85.
#   (in main->multiservices)

#   Failed test 'start_stop died (Failed to set effective gid to 100 100: Operation not permitted at lib/Ubic/Credentials/OS/POSIX.pm line 246.)'
#   at t/ubic.t line 85.
#   (in main->start_stop)
# Looks like you failed 2 tests of 18.
t/ubic.t ....................... 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/18 subtests 
    (less 4 skipped subtests: 12 okay)

#   Failed test 'autostart'
#   at t/watchdog-autostart.t line 35.
#   (in main->autostart)
#          got: 'not running'
#     expected: 'running'
# Looks like you failed 1 test of 4.
t/watchdog-autostart.t ......... 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/4 subtests 

#   Failed test 'check_timeout died (Failed to set effective gid to 100 100: Operation not permitted at lib/Ubic/Credentials/OS/POSIX.pm line 246.)'
#   at t/watchdog.t line 118.
#   (in main->check_timeout)

#   Failed test 'extended_status died (Failed to set effective gid to 100 100: Operation not permitted at lib/Ubic/Credentials/OS/POSIX.pm line 246.)'
#   at t/watchdog.t line 118.
#   (in main->extended_status)

#   Failed test 'reviving died (Failed to set effective gid to 100 100: Operation not permitted at lib/Ubic/Credentials/OS/POSIX.pm line 246.)'
#   at t/watchdog.t line 118.
#   (in main->reviving)

#   Failed test 'watchdog is silent when everything is ok'
#   at t/watchdog.t line 28.
#   (in main->silence)
# Looks like you failed 4 tests of 20.
t/watchdog.t ................... 
Dubious, test returned 4 (wstat 1024, 0x400)
Failed 4/20 subtests 
    (less 4 skipped subtests: 12 okay)

Test Summary Report
-------------------
t/cmd.t                      (Wstat: 65280 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 8 tests but ran 1.
t/run.t                      (Wstat: 2816 Tests: 20 Failed: 11)
  Failed tests:  1-2, 4, 6-7, 9, 11-12, 14, 18-19
  Non-zero exit status: 11
t/ubic.t                     (Wstat: 512 Tests: 18 Failed: 2)
  Failed tests:  10, 14
  Non-zero exit status: 2
t/watchdog-autostart.t       (Wstat: 256 Tests: 4 Failed: 1)
  Failed test:  2
  Non-zero exit status: 1
t/watchdog.t                 (Wstat: 1024 Tests: 20 Failed: 4)
  Failed tests:  1, 5, 14, 18
  Non-zero exit status: 4
Files=29, Tests=332, 90 wallclock secs ( 0.17 usr  0.03 sys + 14.62 cusr  1.27 csys = 16.09 CPU)
Result: FAIL
Failed 5/29 test programs. 19/332 subtests failed.
make: *** [test_dynamic] Error 4
-> FAIL Installing Ubic::Multiservice::Simple failed. See /home/vats/.cpanm/work/1449925581.7615/build.log for details. Retry with --force to force install it.
Searching Ubic::Service::SimpleDaemon on cpanmetadb ...
Already tried Ubic-1.58. Skipping.

For now, I have forced installed it. From my asking around, it is unconventional for tests to demand sudo privileges.

ghost avatar Dec 13 '15 06:12 ghost