Skip to content

Commit

Permalink
Initial upload to github
Browse files Browse the repository at this point in the history
  • Loading branch information
david-dick committed Jul 3, 2022
0 parents commit e811446
Show file tree
Hide file tree
Showing 12 changed files with 888 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Revision history for Test-Rsyslog

0.06 Fri Mar 31 18:46:00 2017
Lowering minimum perl version

0.05 Thu Mar 30 17:40:00 2017
Fixing failing test to wait for rsyslog to output log entries

0.04 Tue Mar 21 06:14:00 2017
Adding additional methods to improve test results

0.03 Thu Mar 09 22:10:00 2017
Added README.

0.02 Thu Mar 09 21:36:00 2017
Re-release for testing.

0.01 Sat Mar 04 16:07:00 2017
Initial release.
12 changes: 12 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Changes
lib/Test/Rsyslog.pm
Makefile.PL
MANIFEST This list of files
README
t/00-load.t
t/01-rsyslog.t
t/manifest.t
t/pod-coverage.t
t/pod.t
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
56 changes: 56 additions & 0 deletions META.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"abstract" : "Creates a temporary instance of rsyslog to run tests against",
"author" : [
"David Dick <[email protected]>"
],
"dynamic_config" : 1,
"generated_by" : "ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150005",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : "2"
},
"name" : "Test-Rsyslog",
"no_index" : {
"directory" : [
"t",
"inc"
]
},
"prereqs" : {
"build" : {
"requires" : {
"Sys::Syslog" : "0",
"Test::More" : "0"
}
},
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "0",
"File::Spec" : "0",
"strict" : "0",
"warnings" : "0"
}
},
"runtime" : {
"requires" : {
"Carp" : "0",
"Config" : "0",
"English" : "0",
"Fcntl" : "0",
"File::Spec" : "0",
"File::Temp" : "0",
"FileHandle" : "0",
"POSIX" : "0",
"perl" : "5.006",
"strict" : "0",
"warnings" : "0"
}
}
},
"release_status" : "stable",
"version" : "0.06",
"x_serialization_backend" : "JSON::PP version 2.27400"
}
37 changes: 37 additions & 0 deletions META.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
abstract: 'Creates a temporary instance of rsyslog to run tests against'
author:
- 'David Dick <[email protected]>'
build_requires:
Sys::Syslog: '0'
Test::More: '0'
configure_requires:
ExtUtils::MakeMaker: '0'
File::Spec: '0'
strict: '0'
warnings: '0'
dynamic_config: 1
generated_by: 'ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150005'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: '1.4'
name: Test-Rsyslog
no_index:
directory:
- t
- inc
requires:
Carp: '0'
Config: '0'
English: '0'
Fcntl: '0'
File::Spec: '0'
File::Temp: '0'
FileHandle: '0'
POSIX: '0'
perl: '5.006'
strict: '0'
warnings: '0'
version: '0.06'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
44 changes: 44 additions & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
use 5.006;
use strict;
use warnings;
use ExtUtils::MakeMaker;
use File::Spec();

my $dev_null = File::Spec->devnull();

my $binary = 'rsyslogd';
system("$binary -v 2>$dev_null >$dev_null") and die "Please install the $binary executable\n";

WriteMakefile(
NAME => 'Test::Rsyslog',
AUTHOR => q{David Dick <[email protected]>},
VERSION_FROM => 'lib/Test/Rsyslog.pm',
ABSTRACT_FROM => 'lib/Test/Rsyslog.pm',
LICENSE => 'perl_5',
PL_FILES => {},
MIN_PERL_VERSION => 5.006,
CONFIGURE_REQUIRES => {
'ExtUtils::MakeMaker' => 0,
'File::Spec' => 0,
'strict' => 0,
'warnings' => 0,
},
BUILD_REQUIRES => {
'Test::More' => 0,
'Sys::Syslog' => 0,
},
PREREQ_PM => {
'Carp' => 0,
'Config' => 0,
'English' => 0,
'FileHandle' => 0,
'File::Temp' => 0,
'Fcntl' => 0,
'File::Spec' => 0,
'POSIX' => 0,
'strict' => 0,
'warnings' => 0,
},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'Test-Rsyslog-*' },
);
176 changes: 176 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
NAME

Test::Rsyslog - Creates a temporary instance of rsyslog to run tests
against

VERSION

Version 0.06

SYNOPSIS

my $rsyslog = Test::Rsyslog->new();

Sys::Syslog::setlogsock({ type => 'unix', path => $rsyslog->socket_path() });
# or "Sys::Syslog::setlogsock('unix', $rsyslog->socket_path());" for older Sys::Syslogs
Sys::Syslog::openlog('program[' . $$ . ']','cons','LOG_LOCAL7');
Sys::Syslog::syslog('info|LOG_LOCAL7','This is a test message');
Sys::Syslog::closelog();

ok($rsyslog->find('This is a test message'), 'Rsyslog is okay');


DESCRIPTION

This module allows easy creation and tear down of a rsyslog instance.
When the variable goes out of scope, the rsyslog instance is torn down
and the file system objects it relies on are removed.

SUBROUTINES/METHODS

new

This method will setup and start the rsyslog instance. It currently has
no parameters, but this may change in response to feature requests

socket_path

This method returns that path to the UNIX file system socket that is
connected to the current running instance of rsyslog

find($string)

This method searches the existing logs that rsyslog has processed to
see if a message has been found matching $string. It will return a list
of every line in the log file that matches $string.

start

This method starts the rsyslog instance

stop

This method stops the rsyslog instance

alive

This method checks to make sure that the rsyslogd instance is still
running

messages

This method returns the content of the rsyslogd log file

scrub

This method truncates the rsyslogd log file. Rsyslogd must be stopped
to truncate the log file

DIAGNOSTICS

Failed to open %s for reading

There has been a file system error trying to read from the rsyslog
logfile.

Failed to print to %s

There has been a file system error trying to write to the rsyslog
configuration file.

Failed to fork

The operating system was unable to fork a subprocess for use by the
rsyslog daemon.

Failed to rmdir %s

There has been a file system error trying to remove the temporary
directory.

Failed to unlink %s

There has been a file system error trying to unlink a temporary file

Failed to close %s

There has been a file system error trying to close a temporary file

Failed to mkdir %s

There has been a file system error trying to make the temporary
directory

Temporary rsyslog daemon is already running...

The rsyslog daemon has already started

Unable to truncate while rsyslogd is still running

This module will not truncate the messages file while rsyslogd could
still be writing to it

Unable to untaint the directory path

The module generated an unrecognisable temporary path for rsyslogd

CONFIGURATION AND ENVIRONMENT

Test::Rsyslog requires no configuration files or environment variables.

DEPENDENCIES

Test::Rsyslog requires Perl 5.6 or better.

INCOMPATIBILITIES

None reported

BUGS AND LIMITATIONS

Please report any bugs or feature requests to bug-test-rsyslog at
rt.cpan.org, or through the web interface at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Rsyslog. I will be
notified, and then you'll automatically be notified of progress on your
bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Test::Rsyslog

You can also look for information at:

* RT: CPAN's request tracker (report bugs here)

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-Rsyslog

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/Test-Rsyslog

* CPAN Ratings

http://cpanratings.perl.org/d/Test-Rsyslog

* Search CPAN

http://search.cpan.org/dist/Test-Rsyslog/

AUTHOR

David Dick, <ddick at cpan.org>

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2017 David Dick.

This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

Loading

0 comments on commit e811446

Please sign in to comment.