Mercurial > hg > nginx-tests
comparison smtp.t @ 57:b5b4271554b0
Test: use TODO for smtp pipelining tests.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sun, 11 Jan 2009 20:33:59 +0300 |
parents | 573c8293ac38 |
children | d053b4bf6ec6 |
comparison
equal
deleted
inserted
replaced
56:573c8293ac38 | 57:b5b4271554b0 |
---|---|
24 | 24 |
25 select STDERR; $| = 1; | 25 select STDERR; $| = 1; |
26 select STDOUT; $| = 1; | 26 select STDOUT; $| = 1; |
27 | 27 |
28 my $t = Test::Nginx->new() | 28 my $t = Test::Nginx->new() |
29 ->has('mail')->plan(26) | 29 ->has('mail')->plan(20) |
30 ->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon) | 30 ->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon) |
31 ->write_file_expand('nginx.conf', <<'EOF')->run(); | 31 ->write_file_expand('nginx.conf', <<'EOF')->run(); |
32 | 32 |
33 master_process off; | 33 master_process off; |
34 daemon off; | 34 daemon off; |
111 $s->send('QUIT'); | 111 $s->send('QUIT'); |
112 $s->ok("quit"); | 112 $s->ok("quit"); |
113 | 113 |
114 # Try auth plain with pipelining | 114 # Try auth plain with pipelining |
115 | 115 |
116 $s = Test::Nginx::SMTP->new(); | 116 TODO: { |
117 $s->check(qr/^220 /, "greeting"); | 117 local $TODO = 'pipelining not in official nginx'; |
118 | 118 |
119 $s->send('EHLO example.com'); | 119 $s = Test::Nginx::SMTP->new(); |
120 $s->check(qr/^250 /, "ehlo"); | 120 $s->read(); |
121 $s->send('EHLO example.com'); | |
122 $s->read(); | |
121 | 123 |
122 $s->send('INVALID COMMAND WITH ARGUMENTS' . CRLF | 124 $s->send('INVALID COMMAND WITH ARGUMENTS' . CRLF |
123 . 'RSET'); | 125 . 'RSET'); |
124 $s->read(); | 126 $s->read(); |
125 $s->ok('pipelined rset after invalid command'); | 127 $s->ok('pipelined rset after invalid command'); |
134 . encode_base64("\0test\@example.com\0secret", '') . CRLF | 136 . encode_base64("\0test\@example.com\0secret", '') . CRLF |
135 . 'MAIL FROM:<test@example.com> SIZE=100'); | 137 . 'MAIL FROM:<test@example.com> SIZE=100'); |
136 $s->read(); | 138 $s->read(); |
137 $s->ok('mail from after pipelined auth'); | 139 $s->ok('mail from after pipelined auth'); |
138 | 140 |
141 } | |
142 | |
139 # Try auth none | 143 # Try auth none |
140 | 144 |
141 $s = Test::Nginx::SMTP->new(); | 145 $s = Test::Nginx::SMTP->new(); |
142 $s->check(qr/^220 /, "greeting"); | 146 $s->read(); |
143 | 147 $s->send('EHLO example.com'); |
144 $s->send('EHLO example.com'); | 148 $s->read(); |
145 $s->check(qr/^250 /, "ehlo"); | |
146 | 149 |
147 $s->send('MAIL FROM:<test@example.com> SIZE=100'); | 150 $s->send('MAIL FROM:<test@example.com> SIZE=100'); |
148 $s->ok('auth none - mail from'); | 151 $s->ok('auth none - mail from'); |
149 | 152 |
150 $s->send('RCPT TO:<test@example.com>'); | 153 $s->send('RCPT TO:<test@example.com>'); |
154 $s->ok('auth none - rset, should go to backend'); | 157 $s->ok('auth none - rset, should go to backend'); |
155 | 158 |
156 # Auth none with pipelining | 159 # Auth none with pipelining |
157 | 160 |
158 $s = Test::Nginx::SMTP->new(); | 161 $s = Test::Nginx::SMTP->new(); |
159 $s->check(qr/^220 /, "greeting"); | 162 $s->read(); |
160 | 163 $s->send('EHLO example.com'); |
161 $s->send('EHLO example.com'); | 164 $s->read(); |
162 $s->check(qr/^250 /, "ehlo"); | |
163 | 165 |
164 $s->send('MAIL FROM:<test@example.com> SIZE=100' . CRLF | 166 $s->send('MAIL FROM:<test@example.com> SIZE=100' . CRLF |
165 . 'RCPT TO:<test@example.com>' . CRLF | 167 . 'RCPT TO:<test@example.com>' . CRLF |
166 . 'RSET'); | 168 . 'RSET'); |
167 | 169 |
168 $s->ok('pipelined mail from'); | 170 $s->ok('pipelined mail from'); |
169 | 171 |
172 TODO: { | |
173 local $TODO = 'pipelining not in official nginx'; | |
174 | |
170 $s->ok('pipelined rcpt to'); | 175 $s->ok('pipelined rcpt to'); |
171 $s->ok('pipelined rset'); | 176 $s->ok('pipelined rset'); |
172 | 177 |
178 } | |
179 | |
173 # Connection must stay even if error returned to rcpt to command | 180 # Connection must stay even if error returned to rcpt to command |
174 | 181 |
175 $s = Test::Nginx::SMTP->new(); | 182 $s = Test::Nginx::SMTP->new(); |
176 $s->read(); # skip greeting | 183 $s->read(); |
177 | 184 $s->send('EHLO example.com'); |
178 $s->send('EHLO example.com'); | 185 $s->read(); |
179 $s->read(); # skip ehlo reply | |
180 | 186 |
181 $s->send('MAIL FROM:<test@example.com> SIZE=100'); | 187 $s->send('MAIL FROM:<test@example.com> SIZE=100'); |
182 $s->read(); # skip mail from reply | 188 $s->read(); # skip mail from reply |
183 | 189 |
184 $s->send('RCPT TO:<example.com>'); | 190 $s->send('RCPT TO:<example.com>'); |