File: space_crash.test.py

package info (click to toggle)
tarantool 1.7.2.385.g952d79e-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 21,556 kB
  • ctags: 28,405
  • sloc: ansic: 180,313; cpp: 26,044; sh: 15,513; python: 4,893; makefile: 1,412
file content (46 lines) | stat: -rw-r--r-- 1,244 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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)