Bug 32979: Skip test if running as root

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 7a8a2d7110)
This commit is contained in:
Kyle Hall 2023-02-17 13:46:58 +00:00 committed by Martin Renvoize
parent 1575f81c8b
commit 94f01de8ab
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -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' );