Skip to content

Commit 8b6d0ef

Browse files
committed
Test concurrent application start with no data.
1 parent 52d0c1a commit 8b6d0ef

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

test/clustering_management_SUITE.erl

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ groups() ->
5353
forget_offline_removes_things,
5454
force_boot,
5555
status_with_alarm,
56-
wait_fails_when_cluster_fails
56+
wait_fails_when_cluster_fails,
57+
concurrent_default_data_creation
5758
]},
5859
{cluster_size_4, [], [
5960
forget_promotes_offline_slave
@@ -636,6 +637,24 @@ wait_fails_when_cluster_fails(Config) ->
636637
{error, _, _} = rabbit_ct_broker_helpers:rabbitmqctl(Config, Rabbit,
637638
["wait", RabbitPidFile]).
638639

640+
concurrent_default_data_creation(Config) ->
641+
[Rabbit, Hare] = rabbit_ct_broker_helpers:get_node_configs(Config,
642+
nodename),
643+
%% Run multiple times to detect race.
644+
[concurrent_default_data_creation1(Rabbit, Hare) || _ <- lists:seq(1, 20)].
645+
646+
concurrent_default_data_creation1(Rabbit, Hare) ->
647+
%% Clear default data.
648+
[{atomic, ok} = rpc:call(Rabbit, mnesia, clear_table, [Tab])
649+
|| Tab <- [rabbit_user, rabbit_user_permission, rabbit_vhost]],
650+
%% Stop both nodes
651+
[ok = rpc:call(Node, rabbit, stop, []) || Node <- [Rabbit, Hare]],
652+
%% Start nodes in parallel
653+
[spawn(fun() -> rpc:call(Node, rabbit, start, []) end)
654+
|| Node <- [Rabbit, Hare]],
655+
%% Verify both nodes are started successfully
656+
[ok = rpc:call(Node, rabbit, await_startup, [Node]) || Node <- [Rabbit, Hare]].
657+
639658
%% ----------------------------------------------------------------------------
640659
%% Internal utils
641660
%% ----------------------------------------------------------------------------

0 commit comments

Comments
 (0)