44 lines
706 B
Perl
44 lines
706 B
Perl
use 5.006;
|
|
use strict;
|
|
use warnings;
|
|
use Test::More;
|
|
use Test::Exception;
|
|
use OSSEC;
|
|
use File::Temp qw/ tempfile tempdir /;
|
|
|
|
|
|
#first create a tempdirectory where we put the logs
|
|
my $tempDir = tempdir( CLEANUP => 0);
|
|
|
|
#create basic directory hierarchy
|
|
readpipe("mkdir $tempDir" . "/logs");
|
|
|
|
my $ossec;
|
|
lives_ok( sub {
|
|
$ossec = OSSEC->new(ossecPath=>$tempDir);
|
|
});
|
|
|
|
my $log;
|
|
lives_ok( sub {
|
|
$log = $ossec->arLog();
|
|
});
|
|
|
|
lives_ok( sub {
|
|
$log->error("test app" , "this is a test");
|
|
});
|
|
|
|
dies_ok( sub {
|
|
$log->fatal("test app" , "this is a test");
|
|
});
|
|
|
|
lives_ok( sub {
|
|
$log->info("test app" , "this is a test");
|
|
});
|
|
|
|
lives_ok( sub {
|
|
$log->debug("test app" , "this is a test");
|
|
});
|
|
|
|
|
|
done_testing();
|