~spuul/nginx/trunk

« back to all changes in this revision

Viewing changes to debian/modules/nginx-lua/t/015-status.t

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2014-02-15 03:05:42 UTC
  • mfrom: (4.3.10 sid)
  • Revision ID: package-import@ubuntu.com-20140215030542-71ubtowl24vf7nfn
Tags: 1.4.5-1ubuntu1
* Resynchronise with Debian (LP: #1280511).  Remaining changes:
  - debian/patches/ubuntu-branding.patch:
    + Add Ubuntu branding to server_tokens.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# vim:set ft= ts=4 sw=4 et fdm=marker:
2
2
 
3
3
use lib 'lib';
4
 
use Test::Nginx::Socket;
 
4
use Test::Nginx::Socket::Lua;
5
5
 
6
6
#worker_connections(1014);
7
7
#master_process_enabled(1);
10
10
#repeat_each(120);
11
11
repeat_each(2);
12
12
 
13
 
plan tests => repeat_each() * (blocks() * 2 + 3);
 
13
plan tests => repeat_each() * (blocks() * 2 + 7);
14
14
 
15
15
#no_diff();
16
16
#no_long_string();
150
150
    }
151
151
--- request
152
152
GET /201
153
 
--- response_body_like: 500 Internal Server Error
154
 
--- error_code: 500
 
153
--- response_body
 
154
created
 
155
--- no_error_log
 
156
[error]
155
157
 
156
158
 
157
159
 
216
218
--- no_error_log
217
219
[error]
218
220
 
 
221
 
 
222
 
 
223
=== TEST 13: 101 response has a complete status line
 
224
--- config
 
225
    location /t {
 
226
        content_by_lua '
 
227
            ngx.status = 101
 
228
            ngx.send_headers()
 
229
        ';
 
230
    }
 
231
--- request
 
232
GET /t
 
233
--- raw_response_headers_like: ^HTTP/1.1 101 Switching Protocols\r\n
 
234
--- error_code: 101
 
235
--- no_error_log
 
236
[error]
 
237
 
 
238
 
 
239
 
 
240
=== TEST 14: reading error status code
 
241
--- config
 
242
    location = /t {
 
243
        content_by_lua 'ngx.say("status = ", ngx.status)';
 
244
    }
 
245
--- raw_request eval
 
246
"GET /t\r\n"
 
247
--- http09
 
248
--- response_body
 
249
status = 9
 
250
 
 
251
 
 
252
 
 
253
=== TEST 15: err status
 
254
--- config
 
255
    location /nil {
 
256
        content_by_lua '
 
257
            ngx.exit(502)
 
258
        ';
 
259
        body_filter_by_lua '
 
260
            if ngx.arg[2] then
 
261
                ngx.log(ngx.WARN, "ngx.status = ", ngx.status)
 
262
            end
 
263
        ';
 
264
    }
 
265
--- request
 
266
GET /nil
 
267
--- response_body_like: 502 Bad Gateway
 
268
--- error_code: 502
 
269
--- error_log
 
270
ngx.status = 502
 
271
--- no_error_log
 
272
[error]
 
273