diff 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
line wrap: on
line diff
--- a/lib/Test/Nginx/SMTP.pm
+++ b/lib/Test/Nginx/SMTP.pm
@@ -21,7 +21,7 @@ sub new {
 
 	$self->{_socket} = IO::Socket::INET->new(
 		Proto => "tcp",
-		PeerAddr => "127.0.0.1:8025",
+		PeerAddr => "127.0.0.1:" . port(8025),
 		@_
 	)
 		or die "Can't connect to nginx: $!\n";
@@ -97,7 +97,7 @@ sub smtp_test_daemon {
 
 	my $server = IO::Socket::INET->new(
 		Proto => 'tcp',
-		LocalAddr => '127.0.0.1:' . ($port || 8026),
+		LocalAddr => '127.0.0.1:' . ($port || port(8026)),
 		Listen => 5,
 		Reuse => 1
 	)