changeset 1686:156cb84b3c23

Tests: IMAP pipelining tests.
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 19 May 2021 04:33:13 +0300
parents 869b312c214e
children 41b213d611f5
files mail_imap.t
diffstat 1 files changed, 40 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mail_imap.t
+++ b/mail_imap.t
@@ -93,7 +93,7 @@ http {
 EOF
 
 $t->run_daemon(\&Test::Nginx::IMAP::imap_test_daemon);
-$t->run()->plan(23);
+$t->run()->plan(29);
 
 $t->waitforsocket('127.0.0.1:' . port(8144));
 
@@ -231,4 +231,43 @@ local $TODO = 'not yet' unless $t->has_v
 
 }
 
+# pipelining
+
+$s = Test::Nginx::IMAP->new();
+$s->read();
+
+$s->send('a01 INVALID COMMAND WITH ARGUMENTS' . CRLF
+	. 'a02 NOOP');
+$s->check(qr/^a01 BAD/, 'pipelined invalid command');
+
+TODO: {
+local $TODO = 'not yet' unless $t->has_version('1.21.0');
+
+$s->ok('pipelined noop after invalid command');
+
+}
+
+$s->send('a03 FOOBAR {10+}' . CRLF
+	. 'test test ' . CRLF
+	. 'a04 NOOP');
+$s->check(qr/^a03 BAD/, 'invalid with non-sync literal');
+$s->check(qr/^(a04 |$)/, 'literal not command');
+
+TODO: {
+todo_skip('not yet', 2) unless $t->has_version('1.21.0');
+
+# skipped without a fix, since with level-triggered event methods
+# this hogs cpu till the connection is closed by the backend server,
+# and generates a lot of debug logs
+
+$s = Test::Nginx::IMAP->new();
+$s->read();
+
+$s->send('a01 LOGIN test@example.com secret' . CRLF
+	. 'a02 LOGOUT');
+$s->ok('pipelined login');
+$s->ok('pipelined logout');
+
+}
+
 ###############################################################################