Skip to content

Commit

Permalink
#69 - is not a bug, but I've implemented a test case, I dunno why I d…
Browse files Browse the repository at this point in the history
…id this
  • Loading branch information
dedok committed Dec 1, 2016
1 parent d477881 commit b610f1a
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 13 deletions.
14 changes: 3 additions & 11 deletions test/basic_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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'

Expand Down
27 changes: 27 additions & 0 deletions test/large_request.py
Original file line number Diff line number Diff line change
@@ -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)'
14 changes: 12 additions & 2 deletions test/ngx_confs/tnt_server_test.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
http {

autoindex off;
autoindex off;
access_log off;

include mime.types;
Expand All @@ -18,7 +18,7 @@ http {

upstream tnt {
server 127.0.0.1:9999 max_fails=1 fail_timeout=1s;
keepalive 1;
keepalive 10;
}

server {
Expand Down Expand Up @@ -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;
}
# ]]

}
}
9 changes: 9 additions & 0 deletions test/test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,12 @@ function update(request)
return request
end
-- ]]

function delete()
return "ok"
end

function issue_59(request, ...)
return { request, {...} }
end

0 comments on commit b610f1a

Please sign in to comment.