Skip to content

Commit 33a9f41

Browse files
committed
queue_type_SUITE: Be explicit about connection open+close
[Why] The tests relied on `rabbit_ct_client_helpers` connection and channel manager which doesn't seem to be robust. It causes more harm than helps so far. Hopefully, this will fix some test flakes in CI.
1 parent 67cbb13 commit 33a9f41

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

deps/rabbit/test/queue_type_SUITE.erl

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ end_per_testcase(Testcase, Config) ->
111111

112112
smoke(Config) ->
113113
Server = rabbit_ct_broker_helpers:get_node_config(Config, 0, nodename),
114-
Ch = rabbit_ct_client_helpers:open_channel(Config, Server),
114+
{Conn, Ch} = rabbit_ct_client_helpers:open_connection_and_channel(Config, Server),
115115
QName = ?config(queue_name, Config),
116116
?assertEqual({'queue.declare_ok', QName, 0, 0},
117117
declare(Ch, QName, [{<<"x-queue-type">>, longstr,
@@ -191,7 +191,7 @@ smoke(Config) ->
191191
}, ProtocolQueueTypeCounters),
192192

193193

194-
ok = rabbit_ct_client_helpers:close_channel(Ch),
194+
ok = rabbit_ct_client_helpers:close_connection_and_channel(Conn, Ch),
195195

196196
?assertMatch(
197197
#{consumers := 0,
@@ -202,7 +202,7 @@ smoke(Config) ->
202202

203203
ack_after_queue_delete(Config) ->
204204
Server = rabbit_ct_broker_helpers:get_node_config(Config, 0, nodename),
205-
Ch = rabbit_ct_client_helpers:open_channel(Config, Server),
205+
{Conn, Ch} = rabbit_ct_client_helpers:open_connection_and_channel(Config, Server),
206206
QName = ?config(queue_name, Config),
207207
?assertEqual({'queue.declare_ok', QName, 0, 0},
208208
declare(Ch, QName, [{<<"x-queue-type">>, longstr,
@@ -223,12 +223,13 @@ ack_after_queue_delete(Config) ->
223223
after 1000 ->
224224
ok
225225
end,
226+
ok = rabbit_ct_client_helpers:close_connection_and_channel(Conn, Ch),
226227
flush(),
227228
ok.
228229

229230
stream(Config) ->
230231
Server = rabbit_ct_broker_helpers:get_node_config(Config, 0, nodename),
231-
Ch = rabbit_ct_client_helpers:open_channel(Config, Server),
232+
{Conn, Ch} = rabbit_ct_client_helpers:open_connection_and_channel(Config, Server),
232233
QName = ?config(queue_name, Config),
233234
?assertEqual({'queue.declare_ok', QName, 0, 0},
234235
declare(Ch, QName, [{<<"x-queue-type">>, longstr,
@@ -238,7 +239,7 @@ stream(Config) ->
238239
publish_and_confirm(Ch, QName, <<"msg1">>),
239240
Args = [{<<"x-stream-offset">>, longstr, <<"last">>}],
240241

241-
SubCh = rabbit_ct_client_helpers:open_channel(Config, 2),
242+
{SubConn, SubCh} = rabbit_ct_client_helpers:open_connection_and_channel(Config, 2),
242243
qos(SubCh, 10, false),
243244
ok = queue_utils:wait_for_local_stream_member(2, <<"/">>, QName, Config),
244245

@@ -262,6 +263,8 @@ stream(Config) ->
262263
exit(Err)
263264
end,
264265

266+
ok = rabbit_ct_client_helpers:close_connection_and_channel(SubConn, SubCh),
267+
ok = rabbit_ct_client_helpers:close_connection_and_channel(Conn, Ch),
265268

266269
ok.
267270

0 commit comments

Comments
 (0)