Esempio n. 1
0
    (65535, b'\xda\xff\xff', b'\xdb\x00\x00\xff\xff'),
    (65536, b'\xdb\x00\x01\x00\x00'),
]

for test in TESTS:
    it = iter(test)
    size = next(it)
    print("STR", size)
    print("--")
    for fmt in it:
        if sys.version[0] == "2":
            print("0x" + fmt.encode("hex"), "=>", end=" ")
        else:
            print("0x" + fmt.hex(), "=>", end=" ")
        field = "*" * size
        c._send_request(
            RawInsert(c, space_id, b'\x91' + fmt + field.encode("utf-8")))
        tuple = space.select(field)[0]
        print(len(tuple[0]) == size and "ok" or "fail", end=" ")
        it2 = iter(test)
        next(it2)
        for fmt2 in it2:
            tuple = c._send_request(
                RawSelect(c, space_id,
                          b'\x91' + fmt2 + field.encode("utf-8")))[0]
            print(len(tuple[0]) == size and "ok" or "fail", end=" ")
        tuple = space.delete(field)[0]
        print(len(tuple[0]) == size and "ok" or "fail", end="")
        print()
    print()

print("Test of schema_id in iproto.")
Esempio n. 2
0
    (32, "\xd9\x20", "\xda\x00\x20", "\xdb\x00\x00\x00\x20"),
    (255, "\xd9\xff", "\xda\x00\xff", "\xdb\x00\x00\x00\xff"),
    (256, "\xda\x01\x00", "\xdb\x00\x00\x01\x00"),
    (65535, "\xda\xff\xff", "\xdb\x00\x00\xff\xff"),
    (65536, "\xdb\x00\x01\x00\x00"),
]

for test in TESTS:
    it = iter(test)
    size = next(it)
    print 'STR', size
    print '--'
    for fmt in it:
        print '0x' + fmt.encode('hex'), '=>',
        field = '*' * size
        c._send_request(RawInsert(c, space_id, "\x91" + fmt + field))
        tuple = space.select(field)[0]
        print len(tuple[0]) == size and 'ok' or 'fail',
        it2 = iter(test)
        next(it2)
        for fmt2 in it2:
            tuple = c._send_request(
                RawSelect(c, space_id, "\x91" + fmt2 + field))[0]
            print len(tuple[0]) == size and 'ok' or 'fail',
        tuple = space.delete(field)[0]
        print len(tuple[0]) == size and 'ok' or 'fail',
        print
    print

print 'Test of schema_id in iproto.'
c = Connection('localhost', server.iproto.port)
Esempio n. 3
0
    (32,    "\xd9\x20", "\xda\x00\x20", "\xdb\x00\x00\x00\x20"),
    (255,   "\xd9\xff", "\xda\x00\xff", "\xdb\x00\x00\x00\xff"),
    (256,   "\xda\x01\x00", "\xdb\x00\x00\x01\x00"),
    (65535, "\xda\xff\xff", "\xdb\x00\x00\xff\xff"),
    (65536, "\xdb\x00\x01\x00\x00"),
]

for test in TESTS:
    it = iter(test)
    size = next(it)
    print 'STR', size
    print '--'
    for fmt in it:
        print '0x' + fmt.encode('hex'), '=>',
        field = '*' * size
        c._send_request(RawInsert(c, space_id, "\x91" + fmt + field))
        tuple = space.select(field)[0]
        print len(tuple[0])== size and 'ok' or 'fail',
        it2 = iter(test)
        next(it2)
        for fmt2 in it2:
            tuple = c._send_request(RawSelect(c, space_id,
                "\x91" + fmt2 + field))[0]
            print len(tuple[0]) == size and 'ok' or 'fail',
        tuple = space.delete(field)[0]
        print len(tuple[0]) == size and 'ok' or 'fail',
        print
    print

admin("space:drop()")
admin("box.schema.user.revoke('guest', 'read,write,execute', 'universe')")