Testsuite: check dynamic port >= 1024 to avoid permission problems
[exim.git] / test / t / 00-basic.t
... / ...
CommitLineData
1use Test::More;
2use lib 'lib';
3use_ok 'Exim::Runtest' or BAIL_OUT 'Can not load the module';
4
5can_ok 'Exim::Runtest', qw(mailgroup dynamic_socket);
6
7subtest 'mailgroup' => sub {
8 my $group = getgrgid $(;
9 ok $group => 'got a group name';
10 diag "use group $group";
11
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";
15
16 ok getgrnam($group) => 'got an existing group';
17};
18
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';
23 cmp_ok $socket->sockport(), '>=', 1024 => 'port is >= 1024';
24 $socket->close;
25};
26
27
28done_testing;