Skip to content

Commit

Permalink
test: update tests according to luatest changes
Browse files Browse the repository at this point in the history
All tests were updated according to tarantool/luatest@930b63b. So this
should resolve the problem with Unix socket collisions that we tried to
fix, for example, in 7ac2685.

NO_DOC=testing stuff
NO_TEST=testing stuff
NO_CHANGELOG=testing stuff
  • Loading branch information
ylobankov committed Apr 11, 2023
1 parent b7d31a5 commit 3a0c9cf
Show file tree
Hide file tree
Showing 63 changed files with 199 additions and 203 deletions.
12 changes: 6 additions & 6 deletions test/box-luatest/builtin_events_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ g.test_box_status = function(cg)
replication_connect_timeout = 0.001,
replication_timeout = 0.001,
}
end, {{server.build_listen_uri('master'),
server.build_listen_uri('replica')}})
end, {{cg.master.net_box_uri,
server.build_listen_uri('replica', cg.replica_set.id)}})
-- here we have 2 notifications: entering ro when can't connect
-- to master and the second one when going orphan
t.helpers.retrying({}, function() t.assert_equals(result_no, 3) end)
Expand Down Expand Up @@ -143,9 +143,9 @@ g.before_test('test_box_election', function(cg)

local box_cfg = {
replication = {
server.build_listen_uri('instance_1'),
server.build_listen_uri('instance_2'),
server.build_listen_uri('instance_3'),
server.build_listen_uri('instance_1', cg.replica_set.id),
server.build_listen_uri('instance_2', cg.replica_set.id),
server.build_listen_uri('instance_3', cg.replica_set.id),
},
replication_connect_quorum = 0,
election_mode = 'off',
Expand Down Expand Up @@ -339,7 +339,7 @@ g.before_test('test_internal_ballot', function(cg)
cg.replica = cg.replica_set:build_and_add_server({
alias = 'replica',
box_cfg = {
replication = server.build_listen_uri('master'),
replication = cg.master.net_box_uri,
replication_timeout = 0.1,
replication_anon = true,
read_only = true,
Expand Down
2 changes: 1 addition & 1 deletion test/box-luatest/gh_6857_tuple_ext_validation_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ g.test_extension_tuple_validation = function()
['interval #7'] = string.fromhex('d6060100d100'), -- bad value (signed)
}

local c = net_box.connect(server.build_listen_uri('default'))
local c = net_box.connect(g.cluster.servers[1].net_box_uri)
t.assert_equals(c.state, 'active', 'Connection established')

-- First check that there are no complaints on correctly-encoded ext types.
Expand Down
2 changes: 1 addition & 1 deletion test/box-luatest/gh_7583_txn_stat_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ g.before_test('test_replication', function(cg)
cg.replica = server:new({
alias = 'replica',
box_cfg = {
replication = server.build_listen_uri('default'),
replication = cg.server.net_box_uri,
},
})
end)
Expand Down
22 changes: 11 additions & 11 deletions test/box-luatest/gh_7974_force_recovery_bugs_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ g.test_unknown_request_type_force_recovery = function()
local datadir = 'test/box-luatest/gh_7974_data/unknown_request_type'
local s = server:new(
{
alias = 'unknown_request_type_ok',
alias = 'gh_7974_urt_ok',
box_cfg = {force_recovery = true},
datadir = datadir,
})
Expand All @@ -27,7 +27,7 @@ g.test_unknown_request_type_force_recovery = function()

s = server:new(
{
alias = 'unknown_request_type_fail',
alias = 'gh_7974_urt_fail',
box_cfg = {force_recovery = false},
datadir = datadir,
})
Expand Down Expand Up @@ -55,7 +55,7 @@ g.test_invalid_non_insert_request_force_recovery = function()
local datadir = 'test/box-luatest/gh_7974_data/invalid_non_insert_request'
local s = server:new(
{
alias = 'invalid_non_insert_request_ok',
alias = 'gh_7974_inir_ok',
box_cfg = {force_recovery = true},
datadir = datadir,
})
Expand All @@ -64,7 +64,7 @@ g.test_invalid_non_insert_request_force_recovery = function()

s = server:new(
{
alias = 'invalid_non_insert_request_fail',
alias = 'gh_7974_inir_fail',
box_cfg = {force_recovery = false},
datadir = datadir,
})
Expand Down Expand Up @@ -95,7 +95,7 @@ g.test_invalid_user_space_request_force_recovery = function()
local datadir = 'test/box-luatest/gh_7974_data/invalid_user_space_request'
local s = server:new(
{
alias = 'invalid_user_space_request_ok',
alias = 'gh_7974_iusr_ok',
box_cfg = {force_recovery = true},
datadir = datadir,
})
Expand All @@ -104,7 +104,7 @@ g.test_invalid_user_space_request_force_recovery = function()

s = server:new(
{
alias = 'invalid_user_space_request_fail',
alias = 'gh_7974_iusr_fail',
box_cfg = {force_recovery = false},
datadir = datadir,
})
Expand Down Expand Up @@ -134,7 +134,7 @@ g.test_first_corrupted_request_force_recovery = function()
local datadir = 'test/box-luatest/gh_7974_data/first_corrupted_request'
local s = server:new(
{
alias = 'first_corrupted_request_fail',
alias = 'gh_7974_fcr_fail',
box_cfg = {force_recovery = true},
datadir = datadir,
})
Expand Down Expand Up @@ -165,7 +165,7 @@ g.test_second_corrupted_request_force_recovery = function()
local datadir = 'test/box-luatest/gh_7974_data/second_corrupted_request'
local s = server:new(
{
alias = 'second_corrupted_request_ok',
alias = 'gh_7974_scr_ok',
box_cfg = {force_recovery = true},
datadir = datadir,
})
Expand All @@ -174,7 +174,7 @@ g.test_second_corrupted_request_force_recovery = function()

s = server:new(
{
alias = 'second_corrupted_request_fail',
alias = 'gh_7974_scr_fail',
box_cfg = {force_recovery = false},
datadir = datadir,
})
Expand Down Expand Up @@ -204,7 +204,7 @@ g.test_empty_snapshot_force_recovery = function()
local datadir = 'test/box-luatest/gh_7974_data/empty_snapshot'
local s = server:new(
{
alias = 'empty_snapshot_fail',
alias = 'gh_7974_es_fail',
box_cfg = {force_recovery = true},
datadir = datadir,
})
Expand Down Expand Up @@ -234,7 +234,7 @@ g.test_only_user_space_request_force_recovery = function()
local datadir = 'test/box-luatest/gh_7974_data/only_user_space_request'
local s = server:new(
{
alias = 'only_user_space_request_fail',
alias = 'gh_7974_ousr_fail',
box_cfg = {force_recovery = true},
datadir = datadir,
})
Expand Down
4 changes: 2 additions & 2 deletions test/box-luatest/gh_7988_auth_type_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ g.before_test('test_replication', function(cg)
cg.replica = server:new({
alias = 'replica',
box_cfg = {
replication = server.build_listen_uri('master'),
replication = cg.server.net_box_uri,
},
})
cg.replica:start()
Expand Down Expand Up @@ -97,5 +97,5 @@ g.test_replication = function(cg)
uri = urilib.format(parsed_uri, true)
box.cfg({replication = uri})
t.assert_equals(box.info.replication[1].upstream.status, 'follow')
end, {server.build_listen_uri('master')})
end, {cg.server.net_box_uri})
end
4 changes: 2 additions & 2 deletions test/box-luatest/gh_8260_system_read_view_list_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,11 @@ g_list.before_all(function(cg)
end)
cg.replica1 = server:new({
alias = 'replica1',
box_cfg = {replication = server.build_listen_uri('master')},
box_cfg = {replication = cg.server.net_box_uri},
})
cg.replica2 = server:new({
alias = 'replica2',
box_cfg = {replication = server.build_listen_uri('master')},
box_cfg = {replication = cg.server.net_box_uri},
})
end)

Expand Down
2 changes: 1 addition & 1 deletion test/engine-luatest/gh_6436_field_constraint_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ g.test_constraint_replication = function(cg)
end, {engine})

local replica_cfg = {
replication = server.build_listen_uri('master'),
replication = cg.server.net_box_uri,
}
local replica = server:new({alias = 'replica', box_cfg = replica_cfg})
replica:start()
Expand Down
70 changes: 31 additions & 39 deletions test/replication-luatest/bootstrap_strategy_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ g_auto.before_test('test_auto_bootstrap_waits_for_confirmations', function(cg)
cg.replica_set = replica_set:new{}
cg.box_cfg = {
replication = {
server.build_listen_uri('server1'),
server.build_listen_uri('server2'),
server.build_listen_uri('server1', cg.replica_set.id),
server.build_listen_uri('server2', cg.replica_set.id),
},
replication_connect_timeout = 1000,
replication_timeout = 0.1,
Expand All @@ -51,7 +51,8 @@ g_auto.before_test('test_auto_bootstrap_waits_for_confirmations', function(cg)
alias = 'server1',
box_cfg = cg.box_cfg,
}
cg.box_cfg.replication[3] = server.build_listen_uri('server3')
cg.box_cfg.replication[3] = server.build_listen_uri('server3',
cg.replica_set.id)
cg.box_cfg.instance_uuid = uuid2
cg.server2 = cg.replica_set:build_and_add_server{
alias = 'server2',
Expand Down Expand Up @@ -82,8 +83,8 @@ g_auto.before_test('test_join_checks_fullmesh', function(cg)
cg.replica_set = replica_set:new{}
cg.box_cfg = {
replication = {
server.build_listen_uri('server1'),
server.build_listen_uri('server2'),
server.build_listen_uri('server1', cg.replica_set.id),
server.build_listen_uri('server2', cg.replica_set.id),
},
replication_timeout = 0.1,
}
Expand Down Expand Up @@ -128,7 +129,7 @@ g_auto.before_test('test_sync_waits_for_all_connected', function(cg)
box_cfg = cg.box_cfg,
}
cg.box_cfg.replication = {
server.build_listen_uri('master'),
cg.master.net_box_uri,
}
cg.replica = cg.replica_set:build_and_add_server{
alias = 'replica',
Expand Down Expand Up @@ -194,7 +195,8 @@ g_config.before_test('test_no_replication', function(cg)
box_cfg = {
replication_timeout = 0.1,
bootstrap_strategy = 'config',
bootstrap_leader = server.build_listen_uri('server1'),
bootstrap_leader = server.build_listen_uri('server1',
cg.replica_set.id),
replication = nil
},
}
Expand Down Expand Up @@ -226,7 +228,6 @@ end)
g_config.test_uuid = function(cg)
cg.replica_set:start()
t.helpers.retrying({}, cg.server1.exec, cg.server1, function()
local t = require('luatest')
t.assert_equals(box.info.status, 'running', 'The server is running')
end)
end
Expand All @@ -242,9 +243,10 @@ g_config.before_test('test_replication_without_bootstrap_leader', function(cg)
box_cfg = {
replication_timeout = 0.1,
bootstrap_strategy = 'config',
bootstrap_leader = server.build_listen_uri('server1'),
bootstrap_leader = server.build_listen_uri('server1',
cg.replica_set.id),
replication = {
server.build_listen_uri('server2'),
server.build_listen_uri('server2', cg.replica_set.id),
},
},
}
Expand Down Expand Up @@ -285,7 +287,7 @@ g_config.before_test('test_no_leader', function(cg)
replication_timeout = 0.1,
bootstrap_strategy = 'config',
bootstrap_leader = nil,
replication = server.build_listen_uri('server1'),
replication = server.build_listen_uri('server1', cg.replica_set.id),
},
env = {
['TARANTOOL_RUN_BEFORE_BOX_CFG'] = set_log_before_cfg,
Expand All @@ -310,16 +312,16 @@ g_config.before_test('test_single_leader', function(cg)
box_cfg = {
replication_timeout = 0.1,
bootstrap_strategy = 'config',
bootstrap_leader = server.build_listen_uri('server1'),
replication = server.build_listen_uri('server1'),
bootstrap_leader = server.build_listen_uri('server1',
cg.replica_set.id),
replication = server.build_listen_uri('server1', cg.replica_set.id),
},
}
end)

g_config.test_single_leader = function(cg)
cg.replica_set:start()
cg.server1:exec(function()
local t = require('luatest')
t.assert_equals(box.info.status, 'running', 'server is working')
end)
end
Expand All @@ -333,51 +335,43 @@ local g_config_success = t.group('gh-7999-bootstrap-strategy-config-success', {
{leader = uuid3},
})

g_config_success.before_each(function(cg)
cg.leader = cg.params.leader
-- cg.params can't have "/" for some reason, so recreate the path here.
if string.match(cg.leader, 'server3') then
cg.leader = server.build_listen_uri(cg.leader)
end
end)

g_config_success.after_each(function(cg)
cg.replica_set:drop()
end)

g_config_success.before_test('test_correct_bootstrap_leader', function(cg)
cg.replica_set = replica_set:new{}
cg.replica_set_a = replica_set:new{}
cg.replica_set_b = replica_set:new{}
local bootstrap_leader = cg.params.leader == 'server3' and
server.build_listen_uri('server3', cg.replica_set_b.id) or
cg.params.leader
cg.server1 = cg.replica_set:build_and_add_server{
alias = 'server1',
box_cfg = {
bootstrap_strategy = 'config',
bootstrap_leader = cg.leader,
bootstrap_leader = bootstrap_leader,
instance_uuid = uuid1,
replication = {
server.build_listen_uri('server1'),
server.build_listen_uri('server2'),
server.build_listen_uri('server3'),
server.build_listen_uri('server1', cg.replica_set.id),
server.build_listen_uri('server2', cg.replica_set_a.id),
server.build_listen_uri('server3', cg.replica_set_b.id),
},
replication_timeout = 0.1,
},
}
cg.replica_set_a = replica_set:new{}
cg.server2 = cg.replica_set_a:build_and_add_server{
alias = 'server2',
box_cfg = {
replicaset_uuid = uuida,
instance_uuid = uuid2,
}
}
cg.replica_set_b = replica_set:new{}
cg.server3 = cg.replica_set_b:build_and_add_server{
alias = 'server3',
box_cfg = {
replicaset_uuid = uuidb,
instance_uuid = uuid3,
listen = {
server.build_listen_uri('server3'),
},
},
}
end)
Expand All @@ -392,23 +386,25 @@ g_config_success.test_correct_bootstrap_leader = function(cg)
cg.replica_set_b:start{}
cg.replica_set:start{}
t.helpers.retrying({}, cg.server1.exec, cg.server1, function(uuid)
local t = require('luatest')
t.assert_equals(box.info.cluster.uuid, uuid,
'Server bootstrapped from correct leader')
end, {uuidb})
end

g_config_success.before_test('test_wait_only_for_leader', function(cg)
cg.replica_set = replica_set:new{}
local bootstrap_leader = cg.params.leader == 'server3' and
server.build_listen_uri('server3', cg.replica_set.id) or
cg.params.leader
cg.server1 = cg.replica_set:build_and_add_server{
alias = 'server1',
box_cfg = {
bootstrap_strategy = 'config',
bootstrap_leader = cg.leader,
bootstrap_leader = bootstrap_leader,
replication = {
server.build_listen_uri('server1'),
server.build_listen_uri('server1', cg.replica_set.id),
server.build_listen_uri('unreachable_2'),
server.build_listen_uri('server3'),
server.build_listen_uri('server3', cg.replica_set.id),
server.build_listen_uri('unreachable_4'),
},
replication_connect_timeout = 1000,
Expand All @@ -420,17 +416,13 @@ g_config_success.before_test('test_wait_only_for_leader', function(cg)
box_cfg = {
replicaset_uuid = uuidb,
instance_uuid = uuid3,
listen = {
server.build_listen_uri('server3'),
},
},
}
end)

g_config_success.test_wait_only_for_leader = function(cg)
cg.replica_set:start{}
t.helpers.retrying({}, cg.server1.exec, cg.server1, function(uuid)
local t = require('luatest')
t.assert_equals(box.info.cluster.uuid, uuid,
'Server boots as soon as sees the leader')
end, {uuidb})
Expand Down
Loading

0 comments on commit 3a0c9cf

Please sign in to comment.