Remove luatest submodule (v2)#455
Conversation
Ubuntu 20.04 is no longer supported by GitHub runners. Note that Tarantool 2.8 and Python 3.7 are too old and not available on ubuntu-latest so they're removed from the test matrix.
|
There's a problem with this update: it breaks auto-requiring of the luatest module from a Tarantool test server. One way to fix that issue is using the original search root, like this: diff --git a/luatest/server.lua b/luatest/server.lua
index 96b1e40e114a..c303952403cc 100644
--- a/luatest/server.lua
+++ b/luatest/server.lua
@@ -347,6 +347,7 @@ function Server:build_env()
TARANTOOL_HTTP_PORT = self.http_port,
TARANTOOL_LISTEN = self.net_box_port or self.net_box_uri,
TARANTOOL_ALIAS = self.alias,
+ TARANTOOL_SEARCHROOT = package.searchroot()
}
if self.box_cfg ~= nil then
res.TARANTOOL_BOX_CFG = json.encode(self.box_cfg)
@@ -834,7 +835,10 @@ function Server:exec(fn, args, options)
for i = 1, debug.getinfo(fn, 'u').nups do
local name, _ = debug.getupvalue(fn, i)
if passthrough_ups[name] then
+ local old_root = package.searchroot()
+ package.setsearchroot(os.getenv('TARANTOOL_SEARCHROOT'))
debug.setupvalue(fn, i, require(passthrough_ups[name]))
+ package.setsearchroot(old_root)
end
end
local result = {xpcall(function()Is there a better way? |
I would prefer to pass In fact, it solves the problem that is more general than just
It seems quite convenient to pass all these paths to the child process from the parent one. |
Totktonada
left a comment
There was a problem hiding this comment.
Thank you!
I've no objections here. It is interesting to try the proposed development flow in practice.
ce9a3ae to
1e0c633
Compare
|
The update with the luatest fix from #455 (comment) still results in 18 Tarantool tests failing. 5 of them are caused by the recent logging update, see tarantool/luatest@2f16ac7. Other tests fail because they explicitly require the luatest module in scripts. Here's the list: |
1e0c633 to
540c01b
Compare
@Totktonada suggested an approach that doesn't require patching luatest: diff --git a/bin/luatest b/bin/luatest
index 8bfb9b5626cd..4afd068e5236 100755
--- a/bin/luatest
+++ b/bin/luatest
@@ -1,5 +1,17 @@
#!/usr/bin/env tarantool
+--
+-- Add the luatest module to LUA_PATH so that it can be used in processes
+-- spawned by tests.
+--
+local fio = require('fio')
+local path = package.search('luatest')
+path = fio.dirname(path) -- strip init.lua
+path = fio.dirname(path) -- strip luatest
+os.setenv('LUA_PATH',
+ path .. '/?.lua;' .. path .. '/?/init.lua;' ..
+ (os.getenv('LUA_PATH') or ';'))
+
print(('Tarantool version is %s'):format(require('tarantool').version))
require('luatest.cli_entrypoint')()It adds the path to the luatest module to Update: Also added an explicit error in case the luatest module isn't found: diff --git a/bin/luatest b/bin/luatest
index 4afd068e5236..e51b98b75178 100755
--- a/bin/luatest
+++ b/bin/luatest
@@ -6,6 +6,9 @@
--
local fio = require('fio')
local path = package.search('luatest')
+if path == nil then
+ error('luatest not found')
+end
path = fio.dirname(path) -- strip init.lua
path = fio.dirname(path) -- strip luatest
os.setenv('LUA_PATH', |
The test-run project is rarely updated these days while luatest is rapidly developing. Let's remove the luatest submodule from test-run to ease luatest bumps in projects using test-run. Now, `luatest` is supposed to be installed from rocks. Closes #453
540c01b to
39bbb2d
Compare
The test-run project is rarely updated these days while luatest is rapidly developing. Let's remove the luatest submodule from test-run to ease luatest bumps in projects using test-run. Now,
luatestis supposed to be installed from rocks.Closes #453
The first version of this patch used a different approach. It required the superproject to pull luatest as a submodule1. We've decided to reject that approach.
Footnotes
https://github.com/tarantool/test-run/pull/454 ↩