diff --git a/test/basic_features.py b/test/basic_features.py index 8fdddc2..11db9cd 100755 --- a/test/basic_features.py +++ b/test/basic_features.py @@ -210,17 +210,10 @@ def batch_cases(): 'id': 555 }) -## TODO fix -#(rc, res) = request({ -# 'params': [], -# 'id': 555 -# }) - -print '[OK] Regualr cases' +print '[+] Regular cases' ## Segfault regress print "[+] Regualr regress cases" - (rc, res) = request_raw('[{"method":"call", "params":["name"], "i'); assert(rc == 400), 'expected 400' assert_if_not_error(res, -32700) @@ -229,13 +222,12 @@ def batch_cases(): assert(rc == 400), 'expected 400' assert_if_not_error(res, -32700) -print '[OK] Segfautl regress cases' - +print '[+] Segfautl regress cases' (rc, res) = request_raw('[{"'); assert(rc == 400), 'expected 400' assert_if_not_error(res, -32700) -print '[OK] PWN cases' +print '[+] PWN cases' (rc, res) = request_raw('[]'); assert(rc == 400), 'expected 400' diff --git a/test/large_request.py b/test/large_request.py new file mode 100755 index 0000000..707d649 --- /dev/null +++ b/test/large_request.py @@ -0,0 +1,27 @@ +#!/usr/bin/python +# -_- encoding: utf8 -_- + +import sys +sys.path.append('./test') +from http_utils import * + +BASE_URL = "http://0.0.0.0:8081/issue_59" +err_msg = { 'error': { 'message': + "Request too large, consider increasing your " + + "server's setting 'client_body_buffer_size'", + 'code': -32001 } } + +preset_method_location = BASE_URL + '/rest_api_parse_query_args' + +obj = {} +for i in range(1, 10000): + obj[str(i) + 'some_key_name'] = [ i, { 'n': i, + 'some_key_name': [[1,2,3],[4]]}] +for i in range(1, 10000): + code, result = post(preset_method_location, { 'params': [obj] }, {}) + assert(code == 400), 'expected 400' + assert(result == err_msg), 'expected error msg (too large)' + + expected = obj[str(i) + 'some_key_name'] + result = post_success(preset_method_location, { 'params': expected }, {}) + assert(result[1] == expected), 'expected != result (too large)' diff --git a/test/ngx_confs/tnt_server_test.conf b/test/ngx_confs/tnt_server_test.conf index a6065a0..c9d33c7 100644 --- a/test/ngx_confs/tnt_server_test.conf +++ b/test/ngx_confs/tnt_server_test.conf @@ -1,6 +1,6 @@ http { - autoindex off; + autoindex off; access_log off; include mime.types; @@ -18,7 +18,7 @@ http { upstream tnt { server 127.0.0.1:9999 max_fails=1 fail_timeout=1s; - keepalive 1; + keepalive 10; } server { @@ -174,5 +174,15 @@ http { tnt_pass tnt; } # ]] + + # QUASTION, BUG -- + # https://github.com/tarantool/nginx_upstream_module/issues/69 [[ + location /issue_59 { + tnt_pass_http_request on parse_args; + tnt_http_rest_methods post get; + tnt_pass tnt; + } + # ]] + } } diff --git a/test/test.lua b/test/test.lua index eb63d2f..7a8fca6 100644 --- a/test/test.lua +++ b/test/test.lua @@ -109,3 +109,12 @@ function update(request) return request end -- ]] + +function delete() + return "ok" +end + +function issue_59(request, ...) + return { request, {...} } +end +