[Tarantool-patches] [PATCH vshard 2/6] test: sort some table prints
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Fri Jul 2 01:09:32 MSK 2021
Router.test.lua and upgrade.test.lua printed some Lua tables which
were not sorted. Next patches are going to alter them slightly and
if the tables are not sorted, some old keys would change place and
increase the diff.
The patch makes these outputs sorted so any amendment won't touch
the existing lines.
---
test/router/router.result | 28 +++++++++++++++++-----------
test/router/router.test.lua | 2 ++
test/upgrade/upgrade.result | 14 +++++++-------
vshard/storage/init.lua | 3 ++-
4 files changed, 28 insertions(+), 19 deletions(-)
diff --git a/test/router/router.result b/test/router/router.result
index f9ee37c..98dd5b5 100644
--- a/test/router/router.result
+++ b/test/router/router.result
@@ -1158,21 +1158,24 @@ end;
_ = test_run:cmd("setopt delimiter ''");
---
...
+table.sort(error_messages)
+---
+...
error_messages
---
-- - Use replicaset:callro(...) instead of replicaset.callro(...)
- - Use replicaset:connect_master(...) instead of replicaset.connect_master(...)
+- - Use replicaset:call(...) instead of replicaset.call(...)
+ - Use replicaset:callbre(...) instead of replicaset.callbre(...)
+ - Use replicaset:callbro(...) instead of replicaset.callbro(...)
- Use replicaset:callre(...) instead of replicaset.callre(...)
- - Use replicaset:down_replica_priority(...) instead of replicaset.down_replica_priority(...)
+ - Use replicaset:callro(...) instead of replicaset.callro(...)
+ - Use replicaset:callrw(...) instead of replicaset.callrw(...)
- Use replicaset:connect(...) instead of replicaset.connect(...)
- - Use replicaset:wait_connected(...) instead of replicaset.wait_connected(...)
- - Use replicaset:up_replica_priority(...) instead of replicaset.up_replica_priority(...)
- - Use replicaset:callbro(...) instead of replicaset.callbro(...)
- Use replicaset:connect_all(...) instead of replicaset.connect_all(...)
+ - Use replicaset:connect_master(...) instead of replicaset.connect_master(...)
- Use replicaset:connect_replica(...) instead of replicaset.connect_replica(...)
- - Use replicaset:call(...) instead of replicaset.call(...)
- - Use replicaset:callrw(...) instead of replicaset.callrw(...)
- - Use replicaset:callbre(...) instead of replicaset.callbre(...)
+ - Use replicaset:down_replica_priority(...) instead of replicaset.down_replica_priority(...)
+ - Use replicaset:up_replica_priority(...) instead of replicaset.up_replica_priority(...)
+ - Use replicaset:wait_connected(...) instead of replicaset.wait_connected(...)
...
_, replica = next(replicaset.replicas)
---
@@ -1192,11 +1195,14 @@ end;
_ = test_run:cmd("setopt delimiter ''");
---
...
+table.sort(error_messages)
+---
+...
error_messages
---
-- - Use replica:safe_uri(...) instead of replica.safe_uri(...)
- - Use replica:detach_conn(...) instead of replica.detach_conn(...)
+- - Use replica:detach_conn(...) instead of replica.detach_conn(...)
- Use replica:is_connected(...) instead of replica.is_connected(...)
+ - Use replica:safe_uri(...) instead of replica.safe_uri(...)
...
--
-- gh-117: Preserve route_map on router.cfg.
diff --git a/test/router/router.test.lua b/test/router/router.test.lua
index aa3eb3b..0017111 100644
--- a/test/router/router.test.lua
+++ b/test/router/router.test.lua
@@ -413,6 +413,7 @@ for _, func in pairs(getmetatable(replicaset).__index) do
table.insert(error_messages, msg:match("Use .*"))
end;
_ = test_run:cmd("setopt delimiter ''");
+table.sort(error_messages)
error_messages
_, replica = next(replicaset.replicas)
@@ -424,6 +425,7 @@ for _, func in pairs(getmetatable(replica).__index) do
table.insert(error_messages, msg:match("Use .*"))
end;
_ = test_run:cmd("setopt delimiter ''");
+table.sort(error_messages)
error_messages
--
diff --git a/test/upgrade/upgrade.result b/test/upgrade/upgrade.result
index 833da3f..8280e5b 100644
--- a/test/upgrade/upgrade.result
+++ b/test/upgrade/upgrade.result
@@ -161,13 +161,13 @@ vshard.storage._call ~= nil
| ...
vshard.storage._call('test_api', 1, 2, 3)
| ---
- | - bucket_recv: true
- | storage_ref: true
- | rebalancer_apply_routes: true
- | storage_map: true
- | rebalancer_request_state: true
- | test_api: true
- | storage_unref: true
+ | - - bucket_recv
+ | - rebalancer_apply_routes
+ | - rebalancer_request_state
+ | - storage_map
+ | - storage_ref
+ | - storage_unref
+ | - test_api
| - 1
| - 2
| - 3
diff --git a/vshard/storage/init.lua b/vshard/storage/init.lua
index 14ec42b..e13a24e 100644
--- a/vshard/storage/init.lua
+++ b/vshard/storage/init.lua
@@ -2566,8 +2566,9 @@ service_call_api = setmetatable({
}, {__serialize = function(api)
local res = {}
for k, _ in pairs(api) do
- res[k] = true
+ table.insert(res, k)
end
+ table.sort(res)
return res
end})
--
2.24.3 (Apple Git-128)
More information about the Tarantool-patches
mailing list