Mercurial > hg > nginx-tests
comparison lib/Test/Nginx/SMTP.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:8025", | 24 PeerAddr => "127.0.0.1:" . port(8025), |
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'}) { |
95 sub smtp_test_daemon { | 95 sub smtp_test_daemon { |
96 my ($port) = @_; | 96 my ($port) = @_; |
97 | 97 |
98 my $server = IO::Socket::INET->new( | 98 my $server = IO::Socket::INET->new( |
99 Proto => 'tcp', | 99 Proto => 'tcp', |
100 LocalAddr => '127.0.0.1:' . ($port || 8026), | 100 LocalAddr => '127.0.0.1:' . ($port || port(8026)), |
101 Listen => 5, | 101 Listen => 5, |
102 Reuse => 1 | 102 Reuse => 1 |
103 ) | 103 ) |
104 or die "Can't create listening socket: $!\n"; | 104 or die "Can't create listening socket: $!\n"; |
105 | 105 |