Skip to content

Commit

Permalink
refactor test/config.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
funny-falcon committed Nov 6, 2016
1 parent 4ccf121 commit 9e9074d
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions test/config.lua
Expand Up @@ -3,18 +3,16 @@ box.cfg{
listen = 33013,
wal_dir='.',
snap_dir='.',
wal_mode='none',
}
if not box.space.test then
local s1 = box.schema.space.create('test', {id = 513, if_not_exists = true})
local ip = s1:create_index('primary', {type = 'hash', parts = {1, 'NUM'}, if_not_exists = true})
local iname = s1:create_index('name', {type = 'tree', parts = {2, 'STR'}, if_not_exists = true})
local irtree = s1:create_index('point', {type = 'rtree', unique=false, parts = {3, 'ARRAY'}, if_not_exists = true})
local ipname = s1:create_index('id_name', {type = 'tree', parts = {1, 'NUM', 2, 'STR'}})
end
if not box.space.test1 then
local s2 = box.schema.space.create('test1', {id = 514, if_not_exists = true})
local ip = s2:create_index('primary', {type = 'hash', parts = {1, 'NUM'}, if_not_exists = true})
end
box.once('initbox', function()
local s1 = box.schema.space.create('test', {id = 513, if_not_exists = true})
local ip = s1:create_index('primary', {type = 'hash', parts = {1, 'NUM'}, if_not_exists = true})
local iname = s1:create_index('name', {type = 'tree', parts = {2, 'STR'}, if_not_exists = true})
local irtree = s1:create_index('point', {type = 'rtree', unique=false, parts = {3, 'ARRAY'}, if_not_exists = true})
local ipname = s1:create_index('id_name', {type = 'tree', parts = {1, 'NUM', 2, 'STR'}})
local s2 = box.schema.space.create('test1', {id = 514, if_not_exists = true})
local ip = s2:create_index('primary', {type = 'hash', parts = {1, 'NUM'}, if_not_exists = true})

function reseed()
local s1 = box.space.test
Expand All @@ -27,15 +25,15 @@ function reseed()
s2:insert{2, "world", {3, 4}, 200}
end

pcall(function()
function func1(i)
return i+1
end

box.schema.user.grant('guest', 'read,write,execute', 'universe')
box.schema.user.create('tester', {password='testpass'})
box.schema.user.grant('tester', 'read,write,execute', 'universe')
end)

if not box.schema.user.exists('tester') then
box.schema.user.create('tester', {password='testpass'})
box.schema.user.grant('tester', 'read,write,execute', 'universe')
end

local console = require 'console'
console.listen '0.0.0.0:33015'

0 comments on commit 9e9074d

Please sign in to comment.