diff mail_smtp_xclient.t @ 970:c227348453db

Tests: simplified parallel modifications in mail tests.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 08 Jul 2016 02:21:16 +0300
parents e9064d691790
children a8b8dd6e8ae1
line wrap: on
line diff
--- a/mail_smtp_xclient.t
+++ b/mail_smtp_xclient.t
@@ -25,7 +25,7 @@ select STDOUT; $| = 1;
 local $SIG{PIPE} = 'IGNORE';
 
 my $t = Test::Nginx->new()->has(qw/mail smtp http rewrite/)->plan(6)
-	->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon, port(2))
+	->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon, port(8026))
 	->write_file_expand('nginx.conf', <<'EOF')->run();
 
 %%TEST_GLOBALS%%
@@ -37,11 +37,11 @@ events {
 
 mail {
     proxy_pass_error_message  on;
-    auth_http  http://127.0.0.1:%%PORT_0%%/mail/auth;
+    auth_http  http://127.0.0.1:8080/mail/auth;
     xclient    on;
 
     server {
-        listen     127.0.0.1:%%PORT_1%%;
+        listen     127.0.0.1:8025;
         protocol   smtp;
         smtp_auth  login plain none;
     }
@@ -51,13 +51,13 @@ http {
     %%TEST_GLOBALS_HTTP%%
 
     server {
-        listen       127.0.0.1:%%PORT_0%%;
+        listen       127.0.0.1:8080;
         server_name  localhost;
 
         location = /mail/auth {
             add_header Auth-Status OK;
             add_header Auth-Server 127.0.0.1;
-            add_header Auth-Port   %%PORT_2%%;
+            add_header Auth-Port   %%PORT_8026%%;
             add_header Auth-Wait   1;
             return 204;
         }
@@ -82,14 +82,14 @@ EOF
 
 # xclient
 
-my $s = Test::Nginx::SMTP->new(PeerAddr => '127.0.0.1:' . port(1));
+my $s = Test::Nginx::SMTP->new();
 $s->read();
 $s->send('AUTH PLAIN ' . encode_base64("\0test\@example.com\0secret", ''));
 $s->authok('xclient');
 
 # xclient, helo
 
-$s = Test::Nginx::SMTP->new(PeerAddr => '127.0.0.1:' . port(1));
+$s = Test::Nginx::SMTP->new();
 $s->read();
 $s->send('HELO example.com');
 $s->read();
@@ -98,7 +98,7 @@ my $s = Test::Nginx::SMTP->new(PeerAddr 
 
 # xclient, ehlo
 
-$s = Test::Nginx::SMTP->new(PeerAddr => '127.0.0.1:' . port(1));
+$s = Test::Nginx::SMTP->new();
 $s->read();
 $s->send('EHLO example.com');
 $s->read();
@@ -107,7 +107,7 @@ my $s = Test::Nginx::SMTP->new(PeerAddr 
 
 # xclient, from, rcpt
 
-$s = Test::Nginx::SMTP->new(PeerAddr => '127.0.0.1:' . port(1));
+$s = Test::Nginx::SMTP->new();
 $s->read();
 $s->send('MAIL FROM:<test@example.com>');
 $s->read();
@@ -116,7 +116,7 @@ my $s = Test::Nginx::SMTP->new(PeerAddr 
 
 # xclient, helo, from, rcpt
 
-$s = Test::Nginx::SMTP->new(PeerAddr => '127.0.0.1:' . port(1));
+$s = Test::Nginx::SMTP->new();
 $s->read();
 $s->send('HELO example.com');
 $s->read();
@@ -127,7 +127,7 @@ my $s = Test::Nginx::SMTP->new(PeerAddr 
 
 # xclient, ehlo, from, rcpt
 
-$s = Test::Nginx::SMTP->new(PeerAddr => '127.0.0.1:' . port(1));
+$s = Test::Nginx::SMTP->new();
 $s->read();
 $s->send('EHLO example.com');
 $s->read();