forked from tarantool/tarantool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gh-5602-environment-vars-cfg.test.lua
executable file
·70 lines (57 loc) · 1.83 KB
/
gh-5602-environment-vars-cfg.test.lua
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env tarantool
local os = require('os')
local fio = require('fio')
local tap = require('tap')
local test = tap.test('gh-5602')
-- gh-5602: Check that environment cfg variables working.
local TARANTOOL_PATH = arg[-1]
local script_name = 'gh-5602-environment-cfg-test-cases.lua'
local path_to_script = fio.pathjoin(
os.getenv('PWD'),
'box-tap',
script_name)
-- Generate a shell command like
-- `FOO=x BAR=y /path/to/tarantool /path/to/script.lua 42`.
local function shell_command(case, i)
return ('%s %s %s %d'):format(
case,
TARANTOOL_PATH,
path_to_script,
i)
end
local listen_sock = fio.pathjoin(fio.cwd(), 'listen.sock')
local repl1_sock = fio.pathjoin(fio.cwd(), 'repl1.sock')
local repl2_sock = fio.pathjoin(fio.cwd(), 'repl2.sock')
local cases = {
-- testcase 1
('%s %s %s %s %s'):format(
string.format('TT_LISTEN=%s', listen_sock),
'TT_READAHEAD=10000',
'TT_STRIP_CORE=false',
'TT_LOG_FORMAT=json',
'TT_LOG_NONBLOCK=false'),
-- testcase 2
('%s %s %s %s'):format(
string.format('TT_LISTEN=%s', listen_sock),
string.format('TT_REPLICATION=%s,%s', repl1_sock,repl2_sock),
'TT_REPLICATION_CONNECT_TIMEOUT=0.01',
'TT_REPLICATION_SYNCHRO_QUORUM=\'4 + 1\''),
-- testcase 3
'TT_BACKGROUND=true TT_VINYL_TIMEOUT=60.1',
-- testcase 4
'TT_SQL_CACHE_SIZE=a',
-- testcase 5
'TT_STRIP_CORE=a',
-- testcase 6
('%s %s %s %s'):format(
string.format('TT_LISTEN=%s', listen_sock),
'TT_LOG=tarantool.log',
'TT_PID_FILE=tarantool.pid',
'TT_BACKGROUND=true'),
}
test:plan(#cases)
for i, case in ipairs(cases) do
local rc = os.execute(shell_command(case, i))
test:is(rc, 0, "tarantool's exit code is ok (0)")
end
os.exit(test:check() and 0 or 1)