Tests: IMAP pipelining tests.
diff --git a/mail_imap.t b/mail_imap.t index 46b7085..e95b306 100644 --- a/mail_imap.t +++ b/mail_imap.t
@@ -93,7 +93,7 @@ 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 @@ } +# 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'); + +} + ###############################################################################