diff options
| author | Diana Corbacho <diana@rabbitmq.com> | 2016-08-19 10:45:55 +0100 |
|---|---|---|
| committer | Diana Corbacho <diana@rabbitmq.com> | 2016-08-19 11:57:10 +0100 |
| commit | 6fc561f14213446f6bfc7ba7e6d946640d5f0d56 (patch) | |
| tree | 458cd41a380861927dd7f36a40361407b9a62b85 | |
| parent | 89a4e14de8dbb73f6369801070c0769a8c766a09 (diff) | |
| download | rabbitmq-server-git-6fc561f14213446f6bfc7ba7e6d946640d5f0d56.tar.gz | |
Test GM crash when group is deleted while processing a DOWN message
| -rw-r--r-- | test/gm_SUITE.erl | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/test/gm_SUITE.erl b/test/gm_SUITE.erl index e4c68a257a..8b07c9efad 100644 --- a/test/gm_SUITE.erl +++ b/test/gm_SUITE.erl @@ -39,7 +39,8 @@ all() -> confirmed_broadcast, member_death, receive_in_order, - unexpected_msg + unexpected_msg, + down_in_members_change ]. init_per_suite(Config) -> @@ -123,6 +124,41 @@ unexpected_msg(_Config) -> passed end). +down_in_members_change(_Config) -> + %% Setup + ok = gm:create_tables(), + {ok, Pid} = gm:start_link(?MODULE, ?MODULE, self(), + fun rabbit_misc:execute_mnesia_transaction/1), + passed = receive_joined(Pid, [Pid], timeout_joining_gm_group_1), + {ok, Pid2} = gm:start_link(?MODULE, ?MODULE, self(), + fun rabbit_misc:execute_mnesia_transaction/1), + passed = receive_joined(Pid2, [Pid, Pid2], timeout_joining_gm_group_2), + passed = receive_birth(Pid, Pid2, timeout_waiting_for_birth_2), + + %% Test. Simulate that the gm group is deleted (forget_group) while + %% processing the 'DOWN' message from the neighbour + process_flag(trap_exit, true), + ok = meck:new(mnesia, [passthrough]), + ok = meck:expect(mnesia, read, fun({gm_group, ?MODULE}) -> + []; + (Key) -> + meck:passthrough([Key]) + end), + gm:leave(Pid2), + Passed = receive + {'EXIT', Pid, normal} -> + passed; + {'EXIT', Pid, _} -> + crashed + after 15000 -> + timeout + end, + %% Cleanup + meck:unload(mnesia), + process_flag(trap_exit, false), + passed = Passed. + + do_broadcast(Fun) -> with_two_members(broadcast_fun(Fun)). |
