-
Notifications
You must be signed in to change notification settings - Fork 376
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
box: expose box.schema before box.cfg
box.schema has a number of constants, e.g. IDs of system spaces, which may be useful for the user. Let's allow to access box.schema before box.cfg is called. It is used in checking names, as we need to know, which snapshot spaces to scan. Needed for #8978 NO_DOC=minor change
- Loading branch information
1 parent
145af72
commit e7ca37b
Showing
7 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## feature/core | ||
|
||
* box.schema can now be accessed before box.cfg(). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
local t = require('luatest') | ||
local treegen = require('test.treegen') | ||
local justrun = require('test.justrun') | ||
|
||
local g = t.group() | ||
|
||
g.test_box_schema_before_box_cfg = function() | ||
treegen.init(g) | ||
local dir = treegen.prepare_directory(g, {}, {}) | ||
treegen.write_script(dir, 'main.lua', [[ | ||
local t = require('luatest') | ||
local schema = box.schema | ||
-- Allowed to call the following functions before box.cfg | ||
t.assert_equals(pcall(schema.downgrade_versions), true) | ||
-- Test, that it's impossible to invoke all other box.schema.*. | ||
local msg = 'Please call box.cfg{} first' | ||
-- t.assert_error_msg_contains(msg, schema.create_space, 'test') | ||
t.assert_error_msg_contains(msg, schema.upgrade) | ||
t.assert_error_msg_contains(msg, schema.downgrade, '3.0.0') | ||
t.assert_error_msg_contains(msg, schema.downgrade_issues, '3.0.0') | ||
t.assert_error_msg_contains(msg, schema.func.bless, {}) | ||
t.assert_error_msg_contains(msg, schema.func.call, 'f') | ||
t.assert_error_msg_contains(msg, schema.func.create, 'f') | ||
t.assert_error_msg_contains(msg, schema.func.drop, 'f') | ||
t.assert_error_msg_contains(msg, schema.func.exists, 'f') | ||
t.assert_error_msg_contains(msg, schema.func.reload, 'f') | ||
t.assert_error_msg_contains(msg, schema.index.alter) | ||
t.assert_error_msg_contains(msg, schema.index.create) | ||
t.assert_error_msg_contains(msg, schema.index.drop) | ||
t.assert_error_msg_contains(msg, schema.index.rename, 1, 1, 'n') | ||
t.assert_error_msg_contains(msg, schema.role.create) | ||
t.assert_error_msg_contains(msg, schema.role.drop) | ||
t.assert_error_msg_contains(msg, schema.role.exists) | ||
t.assert_error_msg_contains(msg, schema.role.grant) | ||
t.assert_error_msg_contains(msg, schema.role.info) | ||
t.assert_error_msg_contains(msg, schema.role.revoke) | ||
t.assert_error_msg_contains(msg, schema.sequence.bless, {}) | ||
t.assert_error_msg_contains(msg, schema.sequence.alter) | ||
t.assert_error_msg_contains(msg, schema.sequence.create, 'n') | ||
t.assert_error_msg_contains(msg, schema.sequence.drop, 'n') | ||
t.assert_error_msg_contains(msg, schema.space.alter, 's') | ||
t.assert_error_msg_contains(msg, schema.space.bless, {}) | ||
t.assert_error_msg_contains(msg, schema.space.create, 's') | ||
t.assert_error_msg_contains(msg, schema.space.drop, 's') | ||
t.assert_error_msg_contains(msg, schema.space.format, 's') | ||
t.assert_error_msg_contains(msg, schema.space.rename, 1, 's') | ||
t.assert_error_msg_contains(msg, schema.user.create) | ||
t.assert_error_msg_contains(msg, schema.user.disable) | ||
t.assert_error_msg_contains(msg, schema.user.drop) | ||
t.assert_error_msg_contains(msg, schema.user.enable) | ||
t.assert_error_msg_contains(msg, schema.user.exists) | ||
t.assert_error_msg_contains(msg, schema.user.grant) | ||
t.assert_error_msg_contains(msg, schema.user.info) | ||
t.assert_error_msg_contains(msg, schema.user.passwd, 's', 's') | ||
t.assert_error_msg_contains(msg, schema.user.password) | ||
t.assert_error_msg_contains(msg, schema.user.revoke) | ||
]]) | ||
|
||
local opts = {nojson = true, stderr = true} | ||
local res = justrun.tarantool(dir, {}, {'main.lua'}, opts) | ||
t.assert_equals(res.stderr, "") | ||
t.assert_equals(res.exit_code, 0) | ||
end |