Skip to content

Commit e46c2d2

Browse files
committed
Tests: IMAP pipelining tests.
1 parent c91ab82 commit e46c2d2

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

mail_imap.t

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ http {
9393
EOF
9494

9595
$t->run_daemon(\&Test::Nginx::IMAP::imap_test_daemon);
96-
$t->run()->plan(23);
96+
$t->run()->plan(29);
9797

9898
$t->waitforsocket('127.0.0.1:' . port(8144));
9999

@@ -231,4 +231,43 @@ $s->ok('backslash in literal');
231231

232232
}
233233

234+
# pipelining
235+
236+
$s = Test::Nginx::IMAP->new();
237+
$s->read();
238+
239+
$s->send('a01 INVALID COMMAND WITH ARGUMENTS' . CRLF
240+
. 'a02 NOOP');
241+
$s->check(qr/^a01 BAD/, 'pipelined invalid command');
242+
243+
TODO: {
244+
local $TODO = 'not yet' unless $t->has_version('1.21.0');
245+
246+
$s->ok('pipelined noop after invalid command');
247+
248+
}
249+
250+
$s->send('a03 FOOBAR {10+}' . CRLF
251+
. 'test test ' . CRLF
252+
. 'a04 NOOP');
253+
$s->check(qr/^a03 BAD/, 'invalid with non-sync literal');
254+
$s->check(qr/^(a04 |$)/, 'literal not command');
255+
256+
TODO: {
257+
todo_skip('not yet', 2) unless $t->has_version('1.21.0');
258+
259+
# skipped without a fix, since with level-triggered event methods
260+
# this hogs cpu till the connection is closed by the backend server,
261+
# and generates a lot of debug logs
262+
263+
$s = Test::Nginx::IMAP->new();
264+
$s->read();
265+
266+
$s->send('a01 LOGIN [email protected] secret' . CRLF
267+
. 'a02 LOGOUT');
268+
$s->ok('pipelined login');
269+
$s->ok('pipelined logout');
270+
271+
}
272+
234273
###############################################################################

0 commit comments

Comments
 (0)