Created
October 5, 2016 13:48
-
-
Save unera/5efd10f60497f667441c6376a967aaa7 to your computer and use it in GitHub Desktop.
get error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env tarantool | |
box.cfg{ logger = '/dev/null' } | |
local test = require('tap').test() | |
test:plan(3) | |
box.schema.space.create( | |
'test', | |
{ | |
engine = 'memtx', | |
format = { { name = 'id' }, { name = 'domain' }, { name = 'path' } }, | |
if_not_exists = true | |
} | |
) | |
box.space.test:create_index( | |
'pk', | |
{ | |
unique = true, | |
type = 'hash', | |
parts = { 1, 'str' }, | |
if_not_exists = true, | |
} | |
) | |
box.space.test:create_index( | |
'pti', | |
{ | |
unique = false, | |
type = 'tree', | |
parts = { 3, 'str', 2, 'str', 1, 'str' }, | |
if_not_exists = true, | |
} | |
) | |
box.space.test:truncate() | |
box.space.test:insert{'first', '', '/path/to'} | |
local tuples = box.space.test.index.pk:select({ 'first' }, { iterator = 'EQ' }) | |
test:is(#tuples, 1, 'one tuple in database') | |
tuples = box.space.test.index.pti:select{ '/path/to', '', 'first' } | |
test:is(#tuples, 1, 'one tuple selected by secondary index') | |
local tuple = box.space.test.index.pti:get{ '/path/to', '', 'first' } | |
test:ok(tuple, 'tuple was selected by :get') | |
os.exit(test:check() == true and 0 or -1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
raise error: