summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPhilip Kuryloski <kuryloskip@vmware.com>2020-06-08 12:36:50 +0200
committerPhilip Kuryloski <kuryloskip@vmware.com>2020-06-09 09:43:47 +0200
commite2c324b79c112b8f99916eaada985367fa35858f (patch)
tree4563c168293875d7afbe3de87731685c24a5092d /test
parenta74639c305173da50a472b289d42d3c461bc1909 (diff)
downloadrabbitmq-server-git-e2c324b79c112b8f99916eaada985367fa35858f.tar.gz
Attempt to increase rabbit_fifo_int_SUITE stability
Wait for messages to have been enqueued before proceeding with the body of the test case
Diffstat (limited to 'test')
-rw-r--r--test/rabbit_fifo_int_SUITE.erl24
1 files changed, 14 insertions, 10 deletions
diff --git a/test/rabbit_fifo_int_SUITE.erl b/test/rabbit_fifo_int_SUITE.erl
index 5790964c91..b51975b062 100644
--- a/test/rabbit_fifo_int_SUITE.erl
+++ b/test/rabbit_fifo_int_SUITE.erl
@@ -475,24 +475,28 @@ test_queries(Config) ->
ClusterName = ?config(cluster_name, Config),
ServerId = ?config(node_id, Config),
ok = start_cluster(ClusterName, [ServerId]),
+ Self = self(),
P = spawn(fun () ->
F0 = rabbit_fifo_client:init(ClusterName, [ServerId], 4),
{ok, F1} = rabbit_fifo_client:enqueue(m1, F0),
{ok, F2} = rabbit_fifo_client:enqueue(m2, F1),
process_ra_events(receive_ra_events(2, 0), F2),
- receive stop -> ok end
+ Self ! ready,
+ receive stop -> ok end
end),
F0 = rabbit_fifo_client:init(ClusterName, [ServerId], 4),
+ ok = receive ready -> ok after 5000 -> timeout end,
{ok, _} = rabbit_fifo_client:checkout(<<"tag">>, 1, undefined, F0),
- {ok, {_, Ready}, _} = ra:local_query(ServerId,
- fun rabbit_fifo:query_messages_ready/1),
- ?assertEqual(1, Ready),
- {ok, {_, Checked}, _} = ra:local_query(ServerId,
- fun rabbit_fifo:query_messages_checked_out/1),
- ?assertEqual(1, Checked),
- {ok, {_, Processes}, _} = ra:local_query(ServerId,
- fun rabbit_fifo:query_processes/1),
- ?assertEqual(2, length(Processes)),
+ ?assertMatch({ok, {_RaIdxTerm, 1}, _Leader},
+ ra:local_query(ServerId,
+ fun rabbit_fifo:query_messages_ready/1)),
+ ?assertMatch({ok, {_RaIdxTerm, 1}, _Leader},
+ ra:local_query(ServerId,
+ fun rabbit_fifo:query_messages_checked_out/1)),
+ ?assertMatch({ok, {_RaIdxTerm, Processes}, _Leader}
+ when length(Processes) == 2,
+ ra:local_query(ServerId,
+ fun rabbit_fifo:query_processes/1)),
P ! stop,
ra:stop_server(ServerId),
ok.