File: cfg.test.lua

package info (click to toggle)
tarantool 2.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 85,364 kB
  • sloc: ansic: 513,760; cpp: 69,489; sh: 25,650; python: 19,190; perl: 14,973; makefile: 4,173; yacc: 1,329; sql: 1,074; pascal: 620; ruby: 190; awk: 18; lisp: 7
file content (161 lines) | stat: -rw-r--r-- 6,090 bytes parent folder | download | duplicates (3)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
env = require('test_run')
test_run = env.new()
test_run:cmd("push filter '(error: .*)\\.lua:[0-9]+: ' to '\\1.lua:<line>: '")
box.cfg.nosuchoption = 1
cfg_filter(box.cfg)
-- must be read-only
box.cfg()
cfg_filter(box.cfg)

-- check that cfg with unexpected parameter fails.
box.cfg{sherlock = 'holmes'}

-- check that cfg with unexpected type of parameter fails
box.cfg{listen = {}}
box.cfg{wal_dir = 0}
box.cfg{coredump = 'true'}

-- check comment to issue #2191 - bad argument #2 to ''uri_parse''
box.cfg{replication = {}}
box.cfg{replication = {}}

--------------------------------------------------------------------------------
-- Test of hierarchical cfg type check
--------------------------------------------------------------------------------

box.cfg{memtx_memory = "100500"}
box.cfg{memtx_memory = -1}
box.cfg{vinyl_memory = -1}
box.cfg{vinyl = "vinyl"}
box.cfg{vinyl_write_threads = "threads"}
--
-- gh-4705: too big memory size led to an assertion.
--
box.cfg{memtx_memory = 5000000000000}
box.cfg{vinyl_memory = 5000000000000}

--------------------------------------------------------------------------------
-- Dynamic configuration check
--------------------------------------------------------------------------------

replication_sync_lag = box.cfg.replication_sync_lag
box.cfg{replication_sync_lag = 0.123}
box.cfg.replication_sync_lag
box.cfg{replication_sync_lag = replication_sync_lag}

replication_sync_timeout = box.cfg.replication_sync_timeout
box.cfg{replication_sync_timeout = 123}
box.cfg.replication_sync_timeout
box.cfg{replication_sync_timeout = replication_sync_timeout}

box.cfg{instance_uuid = box.info.uuid}
box.cfg{instance_uuid = '12345678-0123-5678-1234-abcdefabcdef'}

box.cfg{replicaset_uuid = box.info.cluster.uuid}
box.cfg{replicaset_uuid = '12345678-0123-5678-1234-abcdefabcdef'}

box.cfg{memtx_memory = box.cfg.memtx_memory}
box.cfg{vinyl_memory = box.cfg.vinyl_memory}
box.cfg{sql_cache_size = box.cfg.sql_cache_size}

--------------------------------------------------------------------------------
-- Test of default cfg options
--------------------------------------------------------------------------------

test_run:cmd('create server cfg_tester1 with script = "box/lua/cfg_test1.lua"')
test_run:cmd("start server cfg_tester1")
test_run:cmd('switch cfg_tester1')
box.cfg.memtx_memory, box.cfg.slab_alloc_factor, box.cfg.vinyl_write_threads
test_run:cmd("switch default")
test_run:cmd("stop server cfg_tester1")
test_run:cmd("cleanup server cfg_tester1")

test_run:cmd('create server cfg_tester2 with script = "box/lua/cfg_test2.lua"')
test_run:cmd("start server cfg_tester2")
test_run:cmd('switch cfg_tester2')
box.cfg.memtx_memory, box.cfg.slab_alloc_factor, box.cfg.vinyl_write_threads
test_run:cmd("switch default")
test_run:cmd("stop server cfg_tester2")
test_run:cmd("cleanup server cfg_tester2")

test_run:cmd('create server cfg_tester3 with script = "box/lua/cfg_test3.lua"')
test_run:cmd("start server cfg_tester3")
test_run:cmd('switch cfg_tester3')
box.cfg.memtx_memory, box.cfg.slab_alloc_factor, box.cfg.vinyl_write_threads
test_run:cmd("switch default")
test_run:cmd("stop server cfg_tester3")
test_run:cmd("cleanup server cfg_tester3")

test_run:cmd('create server cfg_tester4 with script = "box/lua/cfg_test4.lua"')
test_run:cmd("start server cfg_tester4")
test_run:cmd('switch cfg_tester4')
box.cfg.memtx_memory, box.cfg.slab_alloc_factor, box.cfg.vinyl_write_threads
test_run:cmd("switch default")
test_run:cmd("stop server cfg_tester4")
test_run:cmd("cleanup server cfg_tester4")

--------------------------------------------------------------------------------
-- Check fix for pid_file option overwritten by tarantoolctl
--------------------------------------------------------------------------------

test_run:cmd('create server cfg_tester5 with script = "box/lua/cfg_test1.lua"')
test_run:cmd("start server cfg_tester5")
test_run:cmd('switch cfg_tester5')
box.cfg{pid_file = "current.pid"}
test_run:cmd("switch default")
test_run:cmd("stop server cfg_tester5")
test_run:cmd("cleanup server cfg_tester5")

--------------------------------------------------------------------------------
-- Check that 'vinyl_dir' cfg option is not checked as long as
-- there is no vinyl indexes (issue #2664)
--------------------------------------------------------------------------------

test_run:cmd('create server cfg_tester with script = "box/lua/cfg_bad_vinyl_dir.lua"')
test_run:cmd("start server cfg_tester")
test_run:cmd('switch cfg_tester')
_ = box.schema.space.create('test_memtx', {engine = 'memtx'})
_ = box.space.test_memtx:create_index('pk') -- ok
_ = box.schema.space.create('test_vinyl', {engine = 'vinyl'})
_ = box.space.test_vinyl:create_index('pk') -- error
box.snapshot()
test_run:cmd("restart server cfg_tester")
test_run:cmd("switch default")
test_run:cmd("stop server cfg_tester")
test_run:cmd("cleanup server cfg_tester")

--
-- gh-3320: box.cfg{net_msg_max}.
--
box.cfg{net_msg_max = 'invalid'}
--
-- gh-3425: incorrect error message: must not contain 'iproto'.
--
box.cfg{net_msg_max = 0}
old = box.cfg.net_msg_max
box.cfg{net_msg_max = 2}
box.cfg{net_msg_max = old + 1000}
box.cfg{net_msg_max = old}

test_run:cmd("clear filter")

--
-- gh-4236: initial box.cfg{} call did not log changes to default state
--
test_run:cmd('create server cfg_tester6 with script = "box/lua/cfg_test5.lua"')
test_run:cmd("start server cfg_tester6")
test_run:grep_log('cfg_tester6', 'set \'vinyl_memory\' configuration option to 1073741824', 1000)
test_run:cmd("stop server cfg_tester6")
test_run:cmd("cleanup server cfg_tester6")

--
-- gh-4493: Replication user password may leak to logs
--
test_run:cmd('create server cfg_tester7 with script = "box/lua/cfg_test6.lua"')
test_run:cmd("start server cfg_tester7")
-- test there is replication log in log
test_run:grep_log('cfg_tester7', 'set \'replication\' configuration option to', 1000)
-- test there is no password in log
test_run:grep_log('cfg_tester7', 'test%-cluster%-cookie', 1000)
test_run:cmd("stop server cfg_tester7")
test_run:cmd("cleanup server cfg_tester7")