Mercurial > hg > nginx-tests
comparison mail_smtp.t @ 1682:57ff83315818
Tests: test for invalid SMTP commands split between packets.
While here, updated the existing split command test to wait for a while
between sending packets, as spurious test passes were observed on the new
test without waiting due to packets being processed by nginx at once.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 19 May 2021 04:33:05 +0300 |
parents | ac26f7f2b187 |
children | dbd19195df8a |
comparison
equal
deleted
inserted
replaced
1681:ac26f7f2b187 | 1682:57ff83315818 |
---|---|
96 } | 96 } |
97 | 97 |
98 EOF | 98 EOF |
99 | 99 |
100 $t->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon); | 100 $t->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon); |
101 $t->run()->plan(39); | 101 $t->run()->plan(41); |
102 | 102 |
103 $t->waitforsocket('127.0.0.1:' . port(8026)); | 103 $t->waitforsocket('127.0.0.1:' . port(8026)); |
104 | 104 |
105 ############################################################################### | 105 ############################################################################### |
106 | 106 |
318 | 318 |
319 $s = Test::Nginx::SMTP->new(); | 319 $s = Test::Nginx::SMTP->new(); |
320 $s->read(); | 320 $s->read(); |
321 | 321 |
322 $s->print('HEL'); | 322 $s->print('HEL'); |
323 select undef, undef, undef, 0.1; | |
323 $s->send('O example.com'); | 324 $s->send('O example.com'); |
324 $s->ok('split command'); | 325 $s->ok('split command'); |
325 | 326 |
327 # Invalid command split into many packets | |
328 | |
329 $s = Test::Nginx::SMTP->new(); | |
330 $s->read(); | |
331 | |
332 $s->print('FOO B'); | |
333 select undef, undef, undef, 0.1; | |
334 $s->send('AR'); | |
335 $s->check(qr/^5.. /, 'invalid split command'); | |
336 | |
337 TODO: { | |
338 local $TODO = 'not yet' unless $t->has_version('1.21.0'); | |
339 | |
340 $s->send('HELO example.com'); | |
341 $s->ok('good after invalid split command'); | |
342 | |
343 } | |
344 | |
326 ############################################################################### | 345 ############################################################################### |