# HG changeset patch # User Maxim Dounin # Date 1621387993 -10800 # Node ID 156cb84b3c2301bee86943f2d204e1bb06eecd70 # Parent 869b312c214e813827f6229540607c82ca5a3e5e Tests: IMAP pipelining tests. diff --git a/mail_imap.t b/mail_imap.t --- 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'); + +} + ###############################################################################