# HG changeset patch # User Maxim Dounin # Date 1621387985 -10800 # Node ID 57ff833158187d9ba3a1e7c848f014eab9afc52b # Parent ac26f7f2b187516f6334598322fe9ad3c81ddcd0 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. diff --git a/mail_smtp.t b/mail_smtp.t --- a/mail_smtp.t +++ b/mail_smtp.t @@ -98,7 +98,7 @@ http { EOF $t->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon); -$t->run()->plan(39); +$t->run()->plan(41); $t->waitforsocket('127.0.0.1:' . port(8026)); @@ -320,7 +320,26 @@ local $TODO = 'not yet' unless $t->has_v $s->read(); $s->print('HEL'); +select undef, undef, undef, 0.1; $s->send('O example.com'); $s->ok('split command'); +# Invalid command split into many packets + +$s = Test::Nginx::SMTP->new(); +$s->read(); + +$s->print('FOO B'); +select undef, undef, undef, 0.1; +$s->send('AR'); +$s->check(qr/^5.. /, 'invalid split command'); + +TODO: { +local $TODO = 'not yet' unless $t->has_version('1.21.0'); + +$s->send('HELO example.com'); +$s->ok('good after invalid split command'); + +} + ###############################################################################