Skip to content
Snippets Groups Projects
Commit 58f26451 authored by Roman Tsisyk's avatar Roman Tsisyk
Browse files

Restore box.info.version

Keep compatibility with Tarantool 1.5
parent c0118cfc
No related branches found
No related tags found
No related merge requests found
......@@ -172,6 +172,16 @@ lbox_info_index(struct lua_State *L)
return 1;
}
/** Push a bunch of compile-time or start-time constants into a Lua table. */
static void
lbox_info_init_static_values(struct lua_State *L)
{
/* tarantool version */
lua_pushstring(L, "version");
lua_pushstring(L, tarantool_version());
lua_settable(L, -3);
}
/**
* When user invokes box.info(), return a table of key/value
* pairs containing the current info.
......@@ -180,6 +190,7 @@ static int
lbox_info_call(struct lua_State *L)
{
lua_newtable(L);
lbox_info_init_static_values(L);
for (int i = 0; lbox_info_dynamic_meta[i].name; i++) {
lua_pushstring(L, lbox_info_dynamic_meta[i].name);
lbox_info_dynamic_meta[i].func(L);
......@@ -217,5 +228,7 @@ box_lua_info_init(struct lua_State *L)
lua_setmetatable(L, -2);
lbox_info_init_static_values(L);
lua_pop(L, 1); /* info module */
}
......@@ -68,7 +68,7 @@ end;
function test_box_info()
local tmp = box.info()
local num = {'pid', 'snapshot_pid', 'recovery_last_update', 'recovery_lag', 'uptime'}
local str = {'status' }
local str = {'version', 'status' }
local failed = {}
if check_type(tmp.server, 'table') == false then
table.insert(failed1, 'box.info().server')
......
......@@ -20,7 +20,7 @@ end;
function test_box_info()
local tmp = box.info()
local num = {'pid', 'snapshot_pid', 'recovery_last_update', 'recovery_lag', 'uptime'}
local str = {'status' }
local str = {'version', 'status' }
local failed = {}
if check_type(tmp.server, 'table') == false then
table.insert(failed1, 'box.info().server')
......
......@@ -12,6 +12,10 @@ box.info['unknown_variable']
---
- null
...
string.match(box.info.version, '^[1-9]') ~= nil
---
- true
...
string.match(box.info.pid, '^[1-9][0-9]*$') ~= nil
---
- true
......@@ -60,6 +64,7 @@ t
- status
- uptime
- vclock
- version
...
box.info.snapshot_pid
---
......
......@@ -3,6 +3,7 @@
box.info.unknown_variable
box.info[23]
box.info['unknown_variable']
string.match(box.info.version, '^[1-9]') ~= nil
string.match(box.info.pid, '^[1-9][0-9]*$') ~= nil
#box.info.server > 0
box.info.recovery_lag
......
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