Skip to content

Commit

Permalink
test: fix cleanup in vinyl-luatest/gh_6565_hot_standby_unsupported test
Browse files Browse the repository at this point in the history
The gh_6565 test doesn't stop the hot standby replica it started,
because the replica should fail to initialize and exit eventually
anyway. However, if the replica lingers until the next test due to
tarantool/test-run#345, the next test may
successfully connect to it, which is likely to lead to a failure,
because UNIX socket paths used by luatest servers are not randomized.

For example, here gh_6568 test fails after gh_6565, because it uses the
same alias for the test instance ('replica'):

NO_WRAP
[008] vinyl-luatest/gh_6565_hot_standby_unsupported_>                 [ pass ]
[008] vinyl-luatest/gh_6568_replica_initial_join_rem>                 [ fail ]
[008] Test failed! Output from reject file /tmp/t/rejects/vinyl-luatest/gh_6568_replica_initial_join_removal_of_compacted_run_files.reject:
[008] TAP version 13
[008] 1..1
[008] # Started on Fri Jul  8 15:30:47 2022
[008] # Starting group: tarantoolgh-6568-replica-initial-join-removal-of-compacted-run-files
[008] not ok 1  tarantoolgh-6568-replica-initial-join-removal-of-compacted-run-files.test_replication_compaction_cleanup
[008] #   builtin/fio.lua:242: fio.pathjoin(): undefined path part 1
[008] #   stack traceback:
[008] #         builtin/fio.lua:242: in function 'pathjoin'
[008] #         ...ica_initial_join_removal_of_compacted_run_files_test.lua:43: in function 'tarantoolgh-6568-replica-initial-join-removal-of-compacted-run-files.test_replication_compaction_cleanup'
[008] #         ...
[008] #         [C]: in function 'xpcall'
[008] replica | 2022-07-08 15:30:48.311 [832856] main/103/default.lua F> can't initialize storage: unlink, called on fd 30, aka unix/:(socket), peer of unix/:(socket): Address already in use
[008] # Ran 1 tests in 0.722 seconds, 0 succeeded, 1 errored
NO_WRAP

Let's fix this by explicitly killing the hot standby replica. Since it
could have exited voluntarily, we need to use pcall, because server.stop
fails if the instance is already dead.

This issue is similar to the one fixed by commit 8504016 ("test:
stop server started by vinyl-luatest/update_optimize test").

NO_DOC=test
NO_CHANGELOG=test
  • Loading branch information
locker authored and mkokryashkin committed Sep 9, 2022
1 parent 9aeb5a2 commit fe5337a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/vinyl-luatest/gh_6565_hot_standby_unsupported_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ g.before_each(function(cg)
end)

g.after_each(function(cg)
-- The replica should fail to initialize and exit by itself, but let's
-- still try to kill it to prevent it from lingering until the next test,
-- because the next test may try to connect to the same URI.
pcall(cg.replica.stop, cg.replica)
cg.master:drop()
end)

Expand Down

0 comments on commit fe5337a

Please sign in to comment.