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>
This commit is contained in:
Kyle M Hall 2023-02-17 13:46:58 +00:00 committed by Tomas Cohen Arazi
parent 2cdc018c81
commit 7a8a2d7110
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 9 additions and 3 deletions

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