comparison lib/Test/Nginx/POP3.pm @ 969:1edb092149e2

Tests: simplified parallel tests. Now configurations are automatically scanned for "127.0.0.1:8xxx", and ports are auto-replaced by free ones. The exact port specified is used if it's free.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 08 Jul 2016 02:21:14 +0300
parents 9361c7eddfc1
children 575d39cc0e35
comparison
equal deleted inserted replaced
968:ce687b25ea49 969:1edb092149e2
19 my $self = {}; 19 my $self = {};
20 bless $self, shift @_; 20 bless $self, shift @_;
21 21
22 $self->{_socket} = IO::Socket::INET->new( 22 $self->{_socket} = IO::Socket::INET->new(
23 Proto => "tcp", 23 Proto => "tcp",
24 PeerAddr => "127.0.0.1:8110", 24 PeerAddr => "127.0.0.1:" . port(8110),
25 @_ 25 @_
26 ) 26 )
27 or die "Can't connect to nginx: $!\n"; 27 or die "Can't connect to nginx: $!\n";
28 28
29 if ({@_}->{'SSL'}) { 29 if ({@_}->{'SSL'}) {
91 sub pop3_test_daemon { 91 sub pop3_test_daemon {
92 my ($port) = @_; 92 my ($port) = @_;
93 93
94 my $server = IO::Socket::INET->new( 94 my $server = IO::Socket::INET->new(
95 Proto => 'tcp', 95 Proto => 'tcp',
96 LocalAddr => '127.0.0.1:' . ($port || 8111), 96 LocalAddr => '127.0.0.1:' . ($port || port(8111)),
97 Listen => 5, 97 Listen => 5,
98 Reuse => 1 98 Reuse => 1
99 ) 99 )
100 or die "Can't create listening socket: $!\n"; 100 or die "Can't create listening socket: $!\n";
101 101