comparison mail_smtp.t @ 1673:7d40f2557a45

Tests: added smtp_client_buffer test.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 22 Apr 2021 13:51:57 +0300
parents 766bcbb632ee
children 74986ebee2fd
comparison
equal deleted inserted replaced
1672:feb754918372 1673:7d40f2557a45
44 44
45 server { 45 server {
46 listen 127.0.0.1:8025; 46 listen 127.0.0.1:8025;
47 protocol smtp; 47 protocol smtp;
48 smtp_auth login plain none cram-md5 external; 48 smtp_auth login plain none cram-md5 external;
49 }
50
51 server {
52 listen 127.0.0.1:8027;
53 protocol smtp;
54 smtp_auth login plain none cram-md5 external;
55 smtp_client_buffer 128;
49 } 56 }
50 } 57 }
51 58
52 http { 59 http {
53 %%TEST_GLOBALS_HTTP%% 60 %%TEST_GLOBALS_HTTP%%
88 } 95 }
89 96
90 EOF 97 EOF
91 98
92 $t->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon); 99 $t->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon);
93 $t->run()->plan(30); 100 $t->run()->plan(36);
94 101
95 $t->waitforsocket('127.0.0.1:' . port(8026)); 102 $t->waitforsocket('127.0.0.1:' . port(8026));
96 103
97 ############################################################################### 104 ###############################################################################
98 105
238 245
239 $s->ok('pipelined mail from'); 246 $s->ok('pipelined mail from');
240 $s->ok('pipelined rcpt to'); 247 $s->ok('pipelined rcpt to');
241 $s->ok('pipelined rset'); 248 $s->ok('pipelined rset');
242 249
250 # Pipelining longer than smtp_client_buffer
251
252 $s = Test::Nginx::SMTP->new(PeerAddr => '127.0.0.1:' . port(8027));
253 $s->read();
254 $s->send('EHLO example.com');
255 $s->read();
256
257 $s->send('MAIL FROM:<test@example.com> SIZE=100' . CRLF
258 . 'RCPT TO:<foo@example.com>' . CRLF
259 . 'RCPT TO:<bar@example.com>' . CRLF
260 . 'RCPT TO:<baz@example.com>' . CRLF
261 . 'RCPT TO:<foobar@example.com>' . CRLF
262 . 'RSET');
263
264 $s->ok('long pipelined mail from');
265
266 TODO: {
267 local $TODO = 'not yet' unless $t->has_version('1.21.0');
268
269 $s->ok('long pipelined rcpt to');
270 $s->ok('long pipelined rcpt to 2');
271 $s->ok('long pipelined rcpt to 3');
272 $s->ok('long pipelined rcpt to 4');
273 $s->ok('long pipelined rset');
274
275 }
276
243 # Connection must stay even if error returned to rcpt to command 277 # Connection must stay even if error returned to rcpt to command
244 278
245 $s = Test::Nginx::SMTP->new(); 279 $s = Test::Nginx::SMTP->new();
246 $s->read(); 280 $s->read();
247 $s->send('EHLO example.com'); 281 $s->send('EHLO example.com');