-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Remove test/luatest_helpers.lua - Move `default_cfg`, `env_cfg`, `box_cfg` functions from test/luatest_helpers.lua to test/instances/default.lua - Move `instance_uri` function from test/luatest_helpers.lua to test/luatest_helpers/server.lua and rename it into `build_instance_uri` - Break down one test into four smaller ones
- Loading branch information
Showing
4 changed files
with
58 additions
and
70 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,44 @@ | ||
#!/usr/bin/env tarantool | ||
|
||
local helpers = require('test.luatest_helpers') | ||
local fun = require('fun') | ||
local json = require('json') | ||
|
||
box.cfg(helpers.box_cfg()) | ||
local function default_cfg() | ||
return { | ||
work_dir = os.getenv('TARANTOOL_WORKDIR'), | ||
listen = os.getenv('TARANTOOL_LISTEN'), | ||
log = ('%s/%s.log'):format(os.getenv('TARANTOOL_WORKDIR'), | ||
os.getenv('TARANTOOL_ALIAS')), | ||
} | ||
end | ||
|
||
local function env_cfg() | ||
local cfg = os.getenv('TARANTOOL_BOX_CFG') | ||
if cfg == nil then | ||
return {} | ||
end | ||
|
||
local res = json.decode(cfg) | ||
assert(type(res) == 'table') | ||
return res | ||
end | ||
|
||
-- Create a table for box.cfg from values passed while server initialization and | ||
-- the given argument. | ||
local function box_cfg(cfg) | ||
return fun.chain(default_cfg(), env_cfg(), cfg or {}):tomap() | ||
end | ||
|
||
box.cfg(box_cfg()) | ||
box.schema.user.grant('guest', 'super', nil, nil, {if_not_exists = true}) | ||
|
||
-- luatest_helpers.Server:start() unblocks only when this variable | ||
-- becomes true. | ||
-- The Server:start function unblocks only when this variable becomes true. | ||
-- | ||
-- Set it when the instance is fully operable: | ||
-- * The server listens for requests. | ||
-- * The database is bootstrapped. | ||
-- * Permissions are granted. | ||
-- | ||
-- * The server listens for requests. | ||
-- * The database is bootstrapped. | ||
-- * Permissions are granted. | ||
-- | ||
-- Use luatest_helpers.Server:start({wait_for_readiness = false}) | ||
-- to don't wait for setting of this variable. | ||
-- Use server:start({wait_for_readiness = false}) to not wait for setting this | ||
-- variable. | ||
_G.ready = true |
This file was deleted.
Oops, something went wrong.
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
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