diff --git a/test/box/space_crash.result b/test/box/space_crash.result new file mode 100644 index 0000000000000000000000000000000000000000..4b13a72631a20e4b259bdbee40e7090b9c9c8264 --- /dev/null +++ b/test/box/space_crash.result @@ -0,0 +1,29 @@ +# +# A test case for: http://bugs.launchpad.net/bugs/712456 +# Verify that when trying to access a non-existing or +# very large space id, no crash occurs. +# + +--- +- error: + errcode: (36) + errmsg: Space '1' does not exist +... +--- +- error: + errcode: (36) + errmsg: Space '65537' does not exist +... +--- +- error: + errcode: (36) + errmsg: Space '4294967295' does not exist +... +# +# A test case for: http://bugs.launchpad.net/bugs/716683 +# Admin console should not stall on unknown command. + +show status +--- +- error: '[string "show status"]:1: ''='' expected near ''status''' +... diff --git a/test/box/space_crash.test.py b/test/box/space_crash.test.py new file mode 100644 index 0000000000000000000000000000000000000000..36a3bca2326252f24cf2259bd8be1868afb5bad4 --- /dev/null +++ b/test/box/space_crash.test.py @@ -0,0 +1,46 @@ +from lib.utils import check_libs +check_libs() +from tarantool.request import RequestSelect + +errstr = """--- +- error: + errcode: {0} + errmsg: {1} +...""" + +def format_error(response): + return errstr.format( + "(%d)" % response.return_code, + response.return_message) + +def format_yamllike(response): + table = ("\n"+"\n".join(["- "+str(list(k)) for k in response])) \ + if len(response) else "" + return "---{0}\n...".format(table) + +def select(conn, space_no, index_no, key, offset=0, limit=0, iterator=0): + data = RequestSelect( + conn, space_no, index_no, + key, offset, limit, iterator + ) + response = conn._send_request(data) + + if response.return_code: + return format_error(response) + return format_yamllike(response) + +print """# +# A test case for: http://bugs.launchpad.net/bugs/712456 +# Verify that when trying to access a non-existing or +# very large space id, no crash occurs. +# +""" +print select(iproto.py_con, 1, 0, [0]) +print select(iproto.py_con, 65537, 0, [0]) +print select(iproto.py_con, 4294967295, 0, [0]) + +print """# +# A test case for: http://bugs.launchpad.net/bugs/716683 +# Admin console should not stall on unknown command. +""" +admin("show status", simple=True) diff --git a/test/box/sql.result b/test/box/sql.result index 4bda0eb580231b95123d78d4825a9711216817f6..420c42904f8d4982b1b121153319ce596aa18923 100644 --- a/test/box/sql.result +++ b/test/box/sql.result @@ -186,29 +186,3 @@ space:delete(0) space:delete(4294967295) --- ... --- A test case for: http://bugs.launchpad.net/bugs/712456 --- Verify that when trying to access a non-existing or --- very large space id, no crash occurs. -conn.space[1]:select{} ---- -- error: '[string "return conn.space[1]:select{} "]:1: attempt to index a nil value' -... -conn.space[65537]:select{} ---- -- error: '[string "return conn.space[65537]:select{} "]:1: attempt to index a nil - value' -... -conn.space[4294967295]:select{} ---- -- error: '[string "return conn.space[4294967295]:select{} "]:1: attempt to index a - nil value' -... -box.space[0]:drop() ---- -... -box.schema.user.drop('test') ---- -... --- A test case for: http://bugs.launchpad.net/bugs/716683 --- Admin console should not stall on unknown command. ---admin("show status", simple=True) diff --git a/test/box/sql.test.lua b/test/box/sql.test.lua index a47d11570e7bbaf570042a46135b0c7bb9c65e4c..447da9ae9817e089c918ecc0833244c17549e5eb 100644 --- a/test/box/sql.test.lua +++ b/test/box/sql.test.lua @@ -75,17 +75,3 @@ space:select{4294967295} -- cleanup space:delete(0) space:delete(4294967295) - --- A test case for: http://bugs.launchpad.net/bugs/712456 --- Verify that when trying to access a non-existing or --- very large space id, no crash occurs. -conn.space[1]:select{} -conn.space[65537]:select{} -conn.space[4294967295]:select{} - -box.space[0]:drop() -box.schema.user.drop('test') - --- A test case for: http://bugs.launchpad.net/bugs/716683 --- Admin console should not stall on unknown command. ---admin("show status", simple=True)