changeset 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 994d1b58cbe8
files mail_smtp.t
diffstat 1 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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');
+
+}
+
 ###############################################################################