Select Git revision
begin_options_validation_test.lua
Oleg Chaplashkin
authored and
Yaroslav Lobankov
committed
After adding the autorequiring luatest [1,2], there is no need to use
the following approach now:
```
local t = require('luatest')
local g = t.group()
server:exec(function()
local t = require('luatest') -- duplicate
t.assert(...)
end)
```
Modern approach looks like:
```
local t = require('luatest')
local g = t.group()
-- `t` already available in the remote server
server:exec(function() t.assert(...) end)
-- also it works with any variable
local my_custom_t = require('luatest')
server:exec(function()
my_custom_t.assert(...) -- already available
end)
```
[1] tarantool/luatest#277
[2] tarantool/luatest#289
Part of tarantool/luatest#233
NO_DOC=test fix
NO_TEST=test fix
NO_CHANGELOG=test fix begin_options_validation_test.lua 830 B
local server = require("luatest.server")
local t = require("luatest")
local g = t.group("begin-options-validation")
g.before_all(function()
g.server = server:new{
alias = "default",
}
g.server:start()
end)
g.after_all(function()
g.server:drop()
end)
g.test_begin_options_validation = function()
g.server:exec(function()
t.assert_error_msg_content_equals(
"Illegal parameters, unexpected option 'foo'",
box.begin, {foo = "bar"})
t.assert_error_msg_content_equals(
"Illegal parameters, timeout must be a number greater than 0",
box.begin, {timeout = "not-a-number"})
t.assert_error_msg_content_equals(
"Illegal parameters, timeout must be a number greater than 0",
box.begin, {timeout = 0})
end)
end