Testsuite: check dynamic port >= 1024 to avoid permission problems
[exim.git] / test / t / 00-basic.t
CommitLineData
acda7677
HSHR
1use Test::More;
2use lib 'lib';
b16852e2 3use_ok 'Exim::Runtest' or BAIL_OUT 'Can not load the module';
acda7677 4
b369d470 5can_ok 'Exim::Runtest', qw(mailgroup dynamic_socket);
acda7677 6
b16852e2
HSHR
7subtest 'mailgroup' => sub {
8 my $group = getgrgid $(;
9 ok $group => 'got a group name';
10 diag "use group $group";
acda7677 11
b16852e2
HSHR
12 is Exim::Runtest::mailgroup($group), $group => 'group names match';
13 ok $group = Exim::Runtest::mailgroup('non existing group') => 'cope with unknown group';
14 diag "got random group: $group";
acda7677 15
b16852e2
HSHR
16 ok getgrnam($group) => 'got an existing group';
17};
acda7677 18
b369d470
HSHR
19subtest 'dynamic_socket' => sub {
20 ok my $socket = Exim::Runtest::dynamic_socket() => 'got a socket';
21 diag "got socket on port @{[$socket->sockport]}";
22 isa_ok $socket => 'IO::Socket::INET';
58ae4e3e 23 cmp_ok $socket->sockport(), '>=', 1024 => 'port is >= 1024';
b369d470
HSHR
24 $socket->close;
25};
acda7677
HSHR
26
27
28done_testing;