NAME
Test::Exim4::Routing - test how exim4 routes mails
SYNOPSIS
use strict;
use Test::More;
use Test::Exim4::Routing;
plan tests => 18;
# Set a custom mailer program
#$Test::Exim4::Routing::mailer = '/opt/usr/sbin/exim4';
config_ok;
routes_ok 'postmaster2@test.internal';
# Check that the router names resolve as we want them:
routes_as 'postmaster2@test.internal', 'virtual_local_mailbox';
routes_as 'outbound@example.com', 'dnslookup';
routes_as 'corion', 'virtual_local_mailbox'; # because ~corion/.forward contains corion@corion.net
routes_as 'corion@corion.net', 'virtual_local_mailbox';
# Check our local domains
for my $domain (qw( corion.net datenzoo.de )) {
routes_as "postmaster\@$domain", 'virtual_local_mailbox';
};
# Check that our exim4 blacklists work:
discards_ok 'vacation@corion.net';
discards_ok 'michael.traven@corion.net';
undeliverable_ok 'does-not-exist@corion.net';
NOTES
This module uses exim4 to verify how exim4 will route mails. This is less a module to test your program and more a module to test your system configuration, especially after changes to the mail configuration.
No mails are sent by this module, as exim4 can tell us the routing of mails without actually sending a mail. This means that we don't need to clean up after testing the routing, but it also means that other problems, like not enough diskspace or mail directories that don't exist will not be detected by this test.
You will need a working copy of exim4 on the machine running these tests.
So far, the module only checks against the default config file and does not allow specifying a different configuration file except in the config_ok check.
EXPORTED TESTS
config_ok $config_file
Checks that exim4 considers the configuration file as syntactically valid. If $config_file is not given, the default config file of exim4 is used.
routes_ok $address, $name
Checks that exim4 knows how to route the email address $address.
routes_as $address, $rule, $name
Checks that exim4 routes $address using the exim4 rule named $rule.
discards_ok $address, $name
Checks that exim4 discards mails with $address as a recipient.
undeliverable_ok $address, $name
Checks that exim4 rejects mails with $address as a recipient as undeliverable.
AUTHOR
Max Maischein corion@cpan.org
COPYRIGHT (c)
Copyright 2008-2009 by Max Maischein corion@cpan.org.
LICENSE
This module is released under the same terms as Perl itself.