Skip to content
Snippets Groups Projects
Commit fc3426d8 authored by Oleg Chaplashkin's avatar Oleg Chaplashkin Committed by Yaroslav Lobankov
Browse files

test: ban direct calling of box.cfg()

Direct call and configuration of the runner instance is prohibited. Now
if you need to test something with specific configuration use a server
instance please (see luatest.Server module).

In-scope-of tarantool/luatest#245

NO_DOC=ban calling box.cfg
NO_TEST=ban calling box.cfg
NO_CHANGELOG=ban calling box.cfg
parent 606e50c4
No related branches found
No related tags found
No related merge requests found
-- There are situations when the Tarantool instance is configured
-- for testing. For example:
--
-- g.test_foo = function()
-- box.cfg{params}
-- ...
-- t.assert_equals(foo, bar)
--
-- g.test_bar = function()
-- t.assert_equals(foo, bar)
--
-- We expect that the test environment will not be configured
-- in the `test_bar` test, but this will not always be the case
-- (depends on the order of execution of tests).
-- We prohibit a direct call to `box.cfg` by overriding the
-- `__call` meta method. Motivating issue tarantool/luatest#245.
box.cfg = setmetatable({}, {__call = function()
error('A direct call to `box.cfg` is forbidden' ..
' (you are changing the test runner instance)', 0)
end})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment