~ubuntu-branches/ubuntu/trusty/nginx/trusty-proposed

« back to all changes in this revision

Viewing changes to debian/modules/nginx-lua/t/024-access/sanity.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
use lib 'lib';
3
 
use Test::Nginx::Socket;
 
3
use Test::Nginx::Socket::Lua;
4
4
 
5
5
#worker_connections(1014);
6
6
#log_level('warn');
9
9
 
10
10
repeat_each(2);
11
11
 
12
 
plan tests => repeat_each() * (blocks() * 2 + 7);
 
12
plan tests => repeat_each() * (blocks() * 2 + 8);
13
13
 
14
14
#no_diff();
15
15
no_long_string();
657
657
 
658
658
=== TEST 34: server access_by_lua
659
659
--- config
660
 
    access_by_lua 'ngx.header["X-Foo"] = "bar" ngx.send_headers()';
 
660
    access_by_lua 'ngx.header["X-Foo"] = "bar" -- ngx.send_headers()';
661
661
--- request
662
662
GET /
663
663
--- response_body chop
672
672
    access_by_lua_file html/foo.lua;
673
673
--- user_files
674
674
>>> foo.lua
675
 
ngx.header["X-Foo"] = "bar" ngx.send_headers()
 
675
ngx.header["X-Foo"] = "bar" -- ngx.send_headers()
676
676
--- request
677
677
GET /
678
678
--- response_body chop
680
680
--- response_headers
681
681
X-Foo: bar
682
682
 
 
683
 
 
684
 
 
685
=== TEST 36: Lua file does not exist
 
686
--- config
 
687
    location /lua {
 
688
        access_by_lua_file html/test2.lua;
 
689
    }
 
690
--- user_files
 
691
>>> test.lua
 
692
v = ngx.var["request_uri"]
 
693
ngx.print("request_uri: ", v, "\n")
 
694
--- request
 
695
GET /lua?a=1&b=2
 
696
--- response_body_like: 500 Internal Server Error
 
697
--- error_code: 500
 
698
--- error_log eval
 
699
qr/failed to load external Lua file: cannot open .*? No such file or directory/
 
700