[Tarantool-patches] [PATCH v2 08/11] luatest: copy config in cluster:build_server()

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Fri Nov 12 02:54:29 MSK 2021

It takes box.cfg config as an argument. And changes the argument
by adding a new key 'command'. If the caller wants to pass the
same box.cfg or slightly modified to several build_server() calls,
it won't work - all options will be the same on all instances.

For example:

    local cfg = {...}
    cfg.replication = {url1}
    cfg.replication = {url2}

It will not work. Both servers will get the same 'command' and the
same 'replication'.
 test/luatest_helpers/cluster.lua | 1 +
 1 file changed, 1 insertion(+)

diff --git a/test/luatest_helpers/cluster.lua b/test/luatest_helpers/cluster.lua
index 01291b43c..43e3479f7 100644
--- a/test/luatest_helpers/cluster.lua
+++ b/test/luatest_helpers/cluster.lua
@@ -93,6 +93,7 @@ end
 function Cluster:build_server(server_config, instance_file)
     instance_file = instance_file or 'default.lua'
+    server_config = table.deepcopy(server_config)
     server_config.command = fio.pathjoin(root, 'test/instances/', instance_file)
     assert(server_config.alias, 'Either replicaset.alias or server.alias must be given')
     local server = Server:new(server_config)
2.24.3 (Apple Git-128)

More information about the Tarantool-patches mailing list