From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Sergei Voronezhskii Subject: [PATCH v3 1/5] test: cleanup replication tests Date: Thu, 6 Dec 2018 16:38:48 +0300 Message-Id: <20181206133852.75633-2-sergw@tarantool.org> In-Reply-To: <20181206133852.75633-1-sergw@tarantool.org> References: <1544088837.816260678@f398.i.mail.ru> <20181206133852.75633-1-sergw@tarantool.org> To: tarantool-patches@freelists.org Cc: Vladimir Davydov List-ID: - at the end of tests which create any replication config need to call: * `test_run:cmd('delete server ...')` removes server object from `TestState.servers` list, this behaviour was taken from `test_run:drop_cluster()` function * `test_run:clenup_cluster()` which clears `box.space._cluster` - switch on `use_unix_sockets` because of 'Address already in use' problems - test `once` need to clean `once*` schemas Part of #2436, #3232 --- test/replication/before_replace.result | 6 +++ test/replication/before_replace.test.lua | 2 + test/replication/catch.result | 7 ++++ test/replication/catch.test.lua | 3 +- test/replication/gc.result | 4 ++ test/replication/gc.test.lua | 1 + test/replication/hot_standby.result | 11 +++++ test/replication/hot_standby.test.lua | 3 ++ test/replication/local_spaces.result | 7 ++++ test/replication/local_spaces.test.lua | 2 + test/replication/misc.result | 46 ++++++++++++++++++--- test/replication/misc.test.lua | 21 +++++++--- test/replication/on_replace.result | 10 +++++ test/replication/on_replace.test.lua | 3 ++ test/replication/once.result | 12 ++++++ test/replication/once.test.lua | 3 ++ test/replication/quorum.result | 3 ++ test/replication/quorum.test.lua | 1 + test/replication/replica_rejoin.result | 7 ++++ test/replication/replica_rejoin.test.lua | 2 + test/replication/skip_conflict_row.result | 7 ++++ test/replication/skip_conflict_row.test.lua | 2 + test/replication/status.result | 7 ++++ test/replication/status.test.lua | 2 + test/replication/suite.ini | 1 + test/replication/sync.result | 7 ++++ test/replication/sync.test.lua | 2 + test/replication/wal_off.result | 7 ++++ test/replication/wal_off.test.lua | 2 + 29 files changed, 178 insertions(+), 13 deletions(-) diff --git a/test/replication/before_replace.result b/test/replication/before_replace.result index abfbc4bb3..ced40547e 100644 --- a/test/replication/before_replace.result +++ b/test/replication/before_replace.result @@ -226,6 +226,9 @@ test_run:cmd("switch default") test_run:drop_cluster(SERVERS) --- ... +test_run:cleanup_cluster() +--- +... -- -- gh-3722: Check that when space:before_replace trigger modifies -- the result of a replicated operation, it writes it to the WAL @@ -300,6 +303,9 @@ test_run:cmd("delete server replica") --- - true ... +test_run:cleanup_cluster() +--- +... box.schema.user.revoke('guest', 'replication') --- ... diff --git a/test/replication/before_replace.test.lua b/test/replication/before_replace.test.lua index fc444cd35..bcc6dc00d 100644 --- a/test/replication/before_replace.test.lua +++ b/test/replication/before_replace.test.lua @@ -80,6 +80,7 @@ box.space.test:select() -- Cleanup. test_run:cmd("switch default") test_run:drop_cluster(SERVERS) +test_run:cleanup_cluster() -- -- gh-3722: Check that when space:before_replace trigger modifies @@ -117,6 +118,7 @@ test_run:cmd("switch default") test_run:cmd("stop server replica") test_run:cmd("cleanup server replica") test_run:cmd("delete server replica") +test_run:cleanup_cluster() box.schema.user.revoke('guest', 'replication') box.space.test:drop() diff --git a/test/replication/catch.result b/test/replication/catch.result index aebba819f..663bdc758 100644 --- a/test/replication/catch.result +++ b/test/replication/catch.result @@ -130,6 +130,13 @@ test_run:cmd("cleanup server replica") --- - true ... +test_run:cmd("delete server replica") +--- +- true +... +test_run:cleanup_cluster() +--- +... box.space.test:drop() --- ... diff --git a/test/replication/catch.test.lua b/test/replication/catch.test.lua index 8cc3242f7..6773675d0 100644 --- a/test/replication/catch.test.lua +++ b/test/replication/catch.test.lua @@ -59,6 +59,7 @@ errinj.set("ERRINJ_RELAY_TIMEOUT", 0) -- cleanup test_run:cmd("stop server replica") test_run:cmd("cleanup server replica") +test_run:cmd("delete server replica") +test_run:cleanup_cluster() box.space.test:drop() box.schema.user.revoke('guest', 'replication') - diff --git a/test/replication/gc.result b/test/replication/gc.result index 6b85513f3..c73544d95 100644 --- a/test/replication/gc.result +++ b/test/replication/gc.result @@ -388,6 +388,10 @@ test_run:cmd("cleanup server replica") --- - true ... +test_run:cmd("delete server replica") +--- +- true +... _ = s:auto_increment{} --- ... diff --git a/test/replication/gc.test.lua b/test/replication/gc.test.lua index c1de68c6c..1e4e02df9 100644 --- a/test/replication/gc.test.lua +++ b/test/replication/gc.test.lua @@ -179,6 +179,7 @@ box.cfg{replication = replica_port} -- Stop the replica and write a few WALs. test_run:cmd("stop server replica") test_run:cmd("cleanup server replica") +test_run:cmd("delete server replica") _ = s:auto_increment{} box.snapshot() _ = s:auto_increment{} diff --git a/test/replication/hot_standby.result b/test/replication/hot_standby.result index e72254f91..b140887df 100644 --- a/test/replication/hot_standby.result +++ b/test/replication/hot_standby.result @@ -318,6 +318,10 @@ test_run:cmd("cleanup server hot_standby") --- - true ... +test_run:cmd("delete server hot_standby") +--- +- true +... test_run:cmd("deploy server default") --- - true @@ -338,3 +342,10 @@ test_run:cmd("cleanup server replica") --- - true ... +test_run:cmd("delete server replica") +--- +- true +... +test_run:cleanup_cluster() +--- +... diff --git a/test/replication/hot_standby.test.lua b/test/replication/hot_standby.test.lua index 1842ff39a..f43982f15 100644 --- a/test/replication/hot_standby.test.lua +++ b/test/replication/hot_standby.test.lua @@ -121,8 +121,11 @@ _select(11, 20) test_run:cmd("stop server hot_standby") test_run:cmd("cleanup server hot_standby") +test_run:cmd("delete server hot_standby") test_run:cmd("deploy server default") test_run:cmd("start server default") test_run:cmd("switch default") test_run:cmd("stop server replica") test_run:cmd("cleanup server replica") +test_run:cmd("delete server replica") +test_run:cleanup_cluster() diff --git a/test/replication/local_spaces.result b/test/replication/local_spaces.result index 151735530..ed1b76da8 100644 --- a/test/replication/local_spaces.result +++ b/test/replication/local_spaces.result @@ -216,6 +216,13 @@ test_run:cmd("cleanup server replica") --- - true ... +test_run:cmd("delete server replica") +--- +- true +... +test_run:cleanup_cluster() +--- +... box.schema.user.revoke('guest', 'replication') --- ... diff --git a/test/replication/local_spaces.test.lua b/test/replication/local_spaces.test.lua index 06e2b0bd2..bb7294538 100644 --- a/test/replication/local_spaces.test.lua +++ b/test/replication/local_spaces.test.lua @@ -76,6 +76,8 @@ box.space.test3:select() test_run:cmd("switch default") test_run:cmd("stop server replica") test_run:cmd("cleanup server replica") +test_run:cmd("delete server replica") +test_run:cleanup_cluster() box.schema.user.revoke('guest', 'replication') s1:select() diff --git a/test/replication/misc.result b/test/replication/misc.result index bebe18db9..32676c4ea 100644 --- a/test/replication/misc.result +++ b/test/replication/misc.result @@ -88,6 +88,13 @@ test_run:cmd('cleanup server test') box.cfg{read_only = false} --- ... +test_run:cmd('delete server test') +--- +- true +... +test_run:cleanup_cluster() +--- +... -- gh-3160 - Send heartbeats if there are changes from a remote master only SERVERS = { 'autobootstrap1', 'autobootstrap2', 'autobootstrap3' } --- @@ -229,6 +236,9 @@ test_run:cmd("switch default") test_run:drop_cluster(SERVERS) --- ... +test_run:cleanup_cluster() +--- +... -- gh-3642 - Check that socket file descriptor doesn't leak -- when a replica is disconnected. rlimit = require('rlimit') @@ -253,7 +263,7 @@ test_run:cmd('create server sock with rpl_master=default, script="replication/re --- - true ... -test_run:cmd(string.format('start server sock')) +test_run:cmd('start server sock') --- - true ... @@ -299,14 +309,21 @@ lim.rlim_cur = old_fno rlimit.setrlimit(rlimit.RLIMIT_NOFILE, lim) --- ... -test_run:cmd('stop server sock') +test_run:cmd("stop server sock") --- - true ... -test_run:cmd('cleanup server sock') +test_run:cmd("cleanup server sock") --- - true ... +test_run:cmd("delete server sock") +--- +- true +... +test_run:cleanup_cluster() +--- +... box.schema.user.revoke('guest', 'replication') --- ... @@ -342,6 +359,17 @@ test_run:cmd('cleanup server er_load2') --- - true ... +test_run:cmd('delete server er_load1') +--- +- true +... +test_run:cmd('delete server er_load2') +--- +- true +... +test_run:cleanup_cluster() +--- +... -- -- Test case for gh-3637. Before the fix replica would exit with -- an error. Now check that we don't hang and successfully connect. @@ -349,9 +377,6 @@ test_run:cmd('cleanup server er_load2') fiber = require('fiber') --- ... -test_run:cleanup_cluster() ---- -... test_run:cmd("create server replica_auth with rpl_master=default, script='replication/replica_auth.lua'") --- - true @@ -391,6 +416,9 @@ test_run:cmd("delete server replica_auth") --- - true ... +test_run:cleanup_cluster() +--- +... box.schema.user.drop('cluster') --- ... @@ -464,6 +492,9 @@ test_run:cmd("delete server replica") --- - true ... +test_run:cleanup_cluster() +--- +... box.schema.user.revoke('guest', 'replication') --- ... @@ -561,3 +592,6 @@ test_run:cmd("delete server replica") --- - true ... +test_run:cleanup_cluster() +--- +... diff --git a/test/replication/misc.test.lua b/test/replication/misc.test.lua index eab36dc52..3bf1fc5a1 100644 --- a/test/replication/misc.test.lua +++ b/test/replication/misc.test.lua @@ -32,6 +32,8 @@ test_run:cmd(string.format('start server test with args="%s"', replica_uuid)) test_run:cmd('stop server test') test_run:cmd('cleanup server test') box.cfg{read_only = false} +test_run:cmd('delete server test') +test_run:cleanup_cluster() -- gh-3160 - Send heartbeats if there are changes from a remote master only SERVERS = { 'autobootstrap1', 'autobootstrap2', 'autobootstrap3' } @@ -89,6 +91,7 @@ box.space.space1:drop() test_run:cmd("switch default") test_run:drop_cluster(SERVERS) +test_run:cleanup_cluster() -- gh-3642 - Check that socket file descriptor doesn't leak -- when a replica is disconnected. @@ -100,7 +103,7 @@ lim.rlim_cur = 64 rlimit.setrlimit(rlimit.RLIMIT_NOFILE, lim) test_run:cmd('create server sock with rpl_master=default, script="replication/replica.lua"') -test_run:cmd(string.format('start server sock')) +test_run:cmd('start server sock') test_run:cmd('switch sock') test_run = require('test_run').new() fiber = require('fiber') @@ -122,8 +125,10 @@ test_run:cmd('switch default') lim.rlim_cur = old_fno rlimit.setrlimit(rlimit.RLIMIT_NOFILE, lim) -test_run:cmd('stop server sock') -test_run:cmd('cleanup server sock') +test_run:cmd("stop server sock") +test_run:cmd("cleanup server sock") +test_run:cmd("delete server sock") +test_run:cleanup_cluster() box.schema.user.revoke('guest', 'replication') @@ -138,15 +143,15 @@ test_run:cmd('stop server er_load1') -- er_load2 exits automatically. test_run:cmd('cleanup server er_load1') test_run:cmd('cleanup server er_load2') +test_run:cmd('delete server er_load1') +test_run:cmd('delete server er_load2') +test_run:cleanup_cluster() -- -- Test case for gh-3637. Before the fix replica would exit with -- an error. Now check that we don't hang and successfully connect. -- fiber = require('fiber') - -test_run:cleanup_cluster() - test_run:cmd("create server replica_auth with rpl_master=default, script='replication/replica_auth.lua'") test_run:cmd("start server replica_auth with wait=False, wait_load=False, args='cluster:pass 0.05'") -- Wait a bit to make sure replica waits till user is created. @@ -161,6 +166,8 @@ _ = test_run:wait_vclock('replica_auth', vclock) test_run:cmd("stop server replica_auth") test_run:cmd("cleanup server replica_auth") test_run:cmd("delete server replica_auth") +test_run:cleanup_cluster() + box.schema.user.drop('cluster') -- @@ -190,6 +197,7 @@ while test_run:grep_log('replica', 'duplicate connection') == nil do fiber.sleep test_run:cmd("stop server replica") test_run:cmd("cleanup server replica") test_run:cmd("delete server replica") +test_run:cleanup_cluster() box.schema.user.revoke('guest', 'replication') -- @@ -227,3 +235,4 @@ test_run:cmd("switch default") test_run:cmd("stop server replica") test_run:cmd("cleanup server replica") test_run:cmd("delete server replica") +test_run:cleanup_cluster() diff --git a/test/replication/on_replace.result b/test/replication/on_replace.result index 4ffa3b25a..8fef8fb14 100644 --- a/test/replication/on_replace.result +++ b/test/replication/on_replace.result @@ -88,6 +88,13 @@ test_run:cmd("cleanup server replica") --- - true ... +test_run:cmd("delete server replica") +--- +- true +... +test_run:cleanup_cluster() +--- +... box.space.test:drop() --- ... @@ -177,3 +184,6 @@ _ = test_run:cmd('switch default') test_run:drop_cluster(SERVERS) --- ... +test_run:cleanup_cluster() +--- +... diff --git a/test/replication/on_replace.test.lua b/test/replication/on_replace.test.lua index 371b71cbd..23a3313b5 100644 --- a/test/replication/on_replace.test.lua +++ b/test/replication/on_replace.test.lua @@ -37,6 +37,8 @@ test_run:cmd("switch default") -- test_run:cmd("stop server replica") test_run:cmd("cleanup server replica") +test_run:cmd("delete server replica") +test_run:cleanup_cluster() box.space.test:drop() box.schema.user.revoke('guest', 'replication') @@ -73,3 +75,4 @@ box.space.s2:select() _ = test_run:cmd('switch default') test_run:drop_cluster(SERVERS) +test_run:cleanup_cluster() diff --git a/test/replication/once.result b/test/replication/once.result index 99ac05b72..fd787915e 100644 --- a/test/replication/once.result +++ b/test/replication/once.result @@ -85,3 +85,15 @@ once -- 1 box.cfg{read_only = false} --- ... +box.space._schema:delete{"oncero"} +--- +- ['oncero'] +... +box.space._schema:delete{"oncekey"} +--- +- ['oncekey'] +... +box.space._schema:delete{"oncetest"} +--- +- ['oncetest'] +... diff --git a/test/replication/once.test.lua b/test/replication/once.test.lua index 264c63670..813fbfdab 100644 --- a/test/replication/once.test.lua +++ b/test/replication/once.test.lua @@ -28,3 +28,6 @@ box.cfg{read_only = true} box.once("ro", f, 1) -- ok, already done once -- 1 box.cfg{read_only = false} +box.space._schema:delete{"oncero"} +box.space._schema:delete{"oncekey"} +box.space._schema:delete{"oncetest"} diff --git a/test/replication/quorum.result b/test/replication/quorum.result index 265b099b7..ff5fa0150 100644 --- a/test/replication/quorum.result +++ b/test/replication/quorum.result @@ -447,6 +447,9 @@ test_run:cmd('delete server replica_quorum') --- - true ... +test_run:cleanup_cluster() +--- +... box.schema.user.revoke('guest', 'replication') --- ... diff --git a/test/replication/quorum.test.lua b/test/replication/quorum.test.lua index 5a43275c2..98febb367 100644 --- a/test/replication/quorum.test.lua +++ b/test/replication/quorum.test.lua @@ -169,4 +169,5 @@ test_run:cmd('switch default') test_run:cmd('stop server replica_quorum') test_run:cmd('cleanup server replica_quorum') test_run:cmd('delete server replica_quorum') +test_run:cleanup_cluster() box.schema.user.revoke('guest', 'replication') diff --git a/test/replication/replica_rejoin.result b/test/replication/replica_rejoin.result index df1057d10..87d626e20 100644 --- a/test/replication/replica_rejoin.result +++ b/test/replication/replica_rejoin.result @@ -379,6 +379,13 @@ test_run:cmd("cleanup server replica") --- - true ... +test_run:cmd("delete server replica") +--- +- true +... +test_run:cleanup_cluster() +--- +... box.space.test:drop() --- ... diff --git a/test/replication/replica_rejoin.test.lua b/test/replication/replica_rejoin.test.lua index 40094a1af..9bf43eff8 100644 --- a/test/replication/replica_rejoin.test.lua +++ b/test/replication/replica_rejoin.test.lua @@ -138,5 +138,7 @@ test_run:cmd("switch default") box.cfg{replication = ''} test_run:cmd("stop server replica") test_run:cmd("cleanup server replica") +test_run:cmd("delete server replica") +test_run:cleanup_cluster() box.space.test:drop() box.schema.user.revoke('guest', 'replication') diff --git a/test/replication/skip_conflict_row.result b/test/replication/skip_conflict_row.result index 29963f56a..6ca13b472 100644 --- a/test/replication/skip_conflict_row.result +++ b/test/replication/skip_conflict_row.result @@ -91,6 +91,13 @@ test_run:cmd("cleanup server replica") --- - true ... +test_run:cmd("delete server replica") +--- +- true +... +test_run:cleanup_cluster() +--- +... box.space.test:drop() --- ... diff --git a/test/replication/skip_conflict_row.test.lua b/test/replication/skip_conflict_row.test.lua index 5f7d6ead3..4406ced95 100644 --- a/test/replication/skip_conflict_row.test.lua +++ b/test/replication/skip_conflict_row.test.lua @@ -31,5 +31,7 @@ box.info.status -- cleanup test_run:cmd("stop server replica") test_run:cmd("cleanup server replica") +test_run:cmd("delete server replica") +test_run:cleanup_cluster() box.space.test:drop() box.schema.user.revoke('guest', 'replication') diff --git a/test/replication/status.result b/test/replication/status.result index 8394b98c1..9e69f2478 100644 --- a/test/replication/status.result +++ b/test/replication/status.result @@ -391,3 +391,10 @@ test_run:cmd("cleanup server replica") --- - true ... +test_run:cmd("delete server replica") +--- +- true +... +test_run:cleanup_cluster() +--- +... diff --git a/test/replication/status.test.lua b/test/replication/status.test.lua index 8bb25e0c6..cfdf6acdb 100644 --- a/test/replication/status.test.lua +++ b/test/replication/status.test.lua @@ -142,3 +142,5 @@ test_run:cmd('switch default') box.schema.user.revoke('guest', 'replication') test_run:cmd("stop server replica") test_run:cmd("cleanup server replica") +test_run:cmd("delete server replica") +test_run:cleanup_cluster() diff --git a/test/replication/suite.ini b/test/replication/suite.ini index 569c90480..260309573 100644 --- a/test/replication/suite.ini +++ b/test/replication/suite.ini @@ -6,5 +6,6 @@ disabled = consistent.test.lua release_disabled = catch.test.lua errinj.test.lua gc.test.lua gc_no_space.test.lua before_replace.test.lua quorum.test.lua recover_missing_xlog.test.lua sync.test.lua config = suite.cfg lua_libs = lua/fast_replica.lua lua/rlimit.lua +use_unix_sockets = True long_run = prune.test.lua is_parallel = False diff --git a/test/replication/sync.result b/test/replication/sync.result index dc3a6f69b..b34501dae 100644 --- a/test/replication/sync.result +++ b/test/replication/sync.result @@ -352,6 +352,13 @@ test_run:cmd("cleanup server replica") --- - true ... +test_run:cmd("delete server replica") +--- +- true +... +test_run:cleanup_cluster() +--- +... box.space.test:drop() --- ... diff --git a/test/replication/sync.test.lua b/test/replication/sync.test.lua index bc7147355..cae97a26f 100644 --- a/test/replication/sync.test.lua +++ b/test/replication/sync.test.lua @@ -171,6 +171,8 @@ box.info.ro -- false test_run:cmd("switch default") test_run:cmd("stop server replica") test_run:cmd("cleanup server replica") +test_run:cmd("delete server replica") +test_run:cleanup_cluster() box.space.test:drop() box.schema.user.revoke('guest', 'replication') diff --git a/test/replication/wal_off.result b/test/replication/wal_off.result index e3b5709e9..e0ae84bd7 100644 --- a/test/replication/wal_off.result +++ b/test/replication/wal_off.result @@ -107,6 +107,13 @@ test_run:cmd("cleanup server wal_off") --- - true ... +test_run:cmd("delete server wal_off") +--- +- true +... +test_run:cleanup_cluster() +--- +... box.schema.user.revoke('guest', 'replication') --- ... diff --git a/test/replication/wal_off.test.lua b/test/replication/wal_off.test.lua index 81fcf0b33..110f2f1f7 100644 --- a/test/replication/wal_off.test.lua +++ b/test/replication/wal_off.test.lua @@ -37,5 +37,7 @@ box.cfg { replication = "" } test_run:cmd("stop server wal_off") test_run:cmd("cleanup server wal_off") +test_run:cmd("delete server wal_off") +test_run:cleanup_cluster() box.schema.user.revoke('guest', 'replication') -- 2.18.0