From 4d457280dfa68da4d72d10b3c8b4fc3eec2688c0 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 17 Feb 2023 13:46:58 +0000 Subject: [PATCH] Bug 32979: Skip test if running as root Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 7a8a2d7110cd7f2fa5d4218665496b4c4be66ab3) (cherry picked from commit 94f01de8ab2b6241852a51062692c34ad044cd04) Signed-off-by: Lucas Gass (cherry picked from commit 1c4e423416455da042bf628bc883ca975882efe8) Signed-off-by: Arthur Suzuki --- t/Logger.t | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/t/Logger.t b/t/Logger.t index b51acd2aea..2b63c8efa5 100755 --- a/t/Logger.t +++ b/t/Logger.t @@ -47,10 +47,16 @@ HERE t::lib::Mocks::mock_config('log4perl_conf', $config_file); - system("chmod 400 $log"); - throws_ok { Koha::Logger->get } qr/Permission denied/, 'Logger did not init correctly without permission'; + my $login = getlogin || getpwuid($<) || q{}; + + SKIP: { + skip "Running as root user", 1 if $login eq 'root'; + + system("chmod 400 $log"); + throws_ok { Koha::Logger->get } qr/Permission denied/, 'Logger did not init correctly without permission'; + system("chmod 700 $log"); + } - system("chmod 700 $log"); my $logger = Koha::Logger->get( { interface => 'intranet' } ); is( exists $logger->{logger}, 1, 'Log4perl config found'); is( $logger->warn('Message 1'), 1, '->warn returned a value' ); -- 2.39.5