Skip to content

Commit da2b0cc

Browse files
author
Daniil Fedotov
committed
Move cleanup to end_per_testcase
1 parent bb608f4 commit da2b0cc

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

test/unit_inbroker_parallel_SUITE.erl

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,6 @@ end_per_group(max_length_mirrored, Config) ->
107107
Config1 = rabbit_ct_helpers:set_config(Config, [{is_mirrored, false}]),
108108
Config1;
109109
end_per_group(queue_max_length, Config) ->
110-
{_, Ch} = rabbit_ct_client_helpers:open_connection_and_channel(Config, 0),
111-
amqp_channel:call(Ch, #'queue.delete'{queue = <<"max_length_reject_queue">>}),
112-
amqp_channel:call(Ch, #'queue.delete'{queue = <<"max_length_drop_publish_queue">>}),
113-
amqp_channel:call(Ch, #'queue.delete'{queue = <<"max_length_drop_head_queue">>}),
114-
amqp_channel:call(Ch, #'queue.delete'{queue = <<"max_length_default_drop_head_queue">>}),
115-
rabbit_ct_client_helpers:close_channels_and_connection(Config, 0),
116110
Config;
117111
end_per_group(Group, Config) ->
118112
case lists:member({group, Group}, all()) of
@@ -127,6 +121,27 @@ end_per_group(Group, Config) ->
127121
init_per_testcase(Testcase, Config) ->
128122
rabbit_ct_helpers:testcase_started(Config, Testcase).
129123

124+
end_per_testcase(max_length_drop_head = Testcase, Config) ->
125+
{_, Ch} = rabbit_ct_client_helpers:open_connection_and_channel(Config, 0),
126+
amqp_channel:call(Ch, #'queue.delete'{queue = <<"max_length_drop_head_queue">>}),
127+
amqp_channel:call(Ch, #'queue.delete'{queue = <<"max_length_default_drop_head_queue">>}),
128+
amqp_channel:call(Ch, #'queue.delete'{queue = <<"max_length_bytes_drop_head_queue">>}),
129+
amqp_channel:call(Ch, #'queue.delete'{queue = <<"max_length_bytes_default_drop_head_queue">>}),
130+
rabbit_ct_client_helpers:close_channels_and_connection(Config, 0),
131+
rabbit_ct_helpers:testcase_finished(Config, Testcase);
132+
133+
end_per_testcase(max_length_reject_confirm = Testcase, Config) ->
134+
{_, Ch} = rabbit_ct_client_helpers:open_connection_and_channel(Config, 0),
135+
amqp_channel:call(Ch, #'queue.delete'{queue = <<"max_length_reject_queue">>}),
136+
amqp_channel:call(Ch, #'queue.delete'{queue = <<"max_length_bytes_reject_queue">>}),
137+
rabbit_ct_client_helpers:close_channels_and_connection(Config, 0),
138+
rabbit_ct_helpers:testcase_finished(Config, Testcase);
139+
end_per_testcase(max_length_drop_publish = Testcase, Config) ->
140+
{_, Ch} = rabbit_ct_client_helpers:open_connection_and_channel(Config, 0),
141+
amqp_channel:call(Ch, #'queue.delete'{queue = <<"max_length_drop_publish_queue">>}),
142+
amqp_channel:call(Ch, #'queue.delete'{queue = <<"max_length_bytes_drop_publish_queue">>}),
143+
rabbit_ct_client_helpers:close_channels_and_connection(Config, 0),
144+
rabbit_ct_helpers:testcase_finished(Config, Testcase);
130145
end_per_testcase(Testcase, Config) ->
131146
rabbit_ct_helpers:testcase_finished(Config, Testcase).
132147

@@ -1051,10 +1066,6 @@ max_length_drop_head(Config) ->
10511066
MaxLengthArgs = [{<<"x-max-length">>, long, 1}],
10521067
MaxLengthBytesArgs = [{<<"x-max-length-bytes">>, long, 100}],
10531068
OverflowArgs = [{<<"x-overflow">>, longstr, <<"drop-head">>}],
1054-
amqp_channel:call(Ch, #'queue.delete'{queue = QName}),
1055-
amqp_channel:call(Ch, #'queue.delete'{queue = QNameDefault}),
1056-
amqp_channel:call(Ch, #'queue.delete'{queue = QNameBytes}),
1057-
amqp_channel:call(Ch, #'queue.delete'{queue = QNameDefaultBytes}),
10581069
#'queue.declare_ok'{} = amqp_channel:call(Ch, #'queue.declare'{queue = QName, arguments = MaxLengthArgs ++ OverflowArgs}),
10591070
#'queue.declare_ok'{} = amqp_channel:call(Ch, #'queue.declare'{queue = QNameDefault, arguments = MaxLengthArgs}),
10601071
#'queue.declare_ok'{} = amqp_channel:call(Ch, #'queue.declare'{queue = QNameBytes, arguments = MaxLengthBytesArgs ++ OverflowArgs}),
@@ -1077,8 +1088,6 @@ max_length_reject_confirm(Config) ->
10771088
MaxLengthArgs = [{<<"x-max-length">>, long, 1}],
10781089
MaxLengthBytesArgs = [{<<"x-max-length-bytes">>, long, 100}],
10791090
OverflowArgs = [{<<"x-overflow">>, longstr, <<"reject-publish">>}],
1080-
amqp_channel:call(Ch, #'queue.delete'{queue = QName}),
1081-
amqp_channel:call(Ch, #'queue.delete'{queue = QNameBytes}),
10821091
#'queue.declare_ok'{} = amqp_channel:call(Ch, #'queue.declare'{queue = QName, arguments = MaxLengthArgs ++ OverflowArgs}),
10831092
#'queue.declare_ok'{} = amqp_channel:call(Ch, #'queue.declare'{queue = QNameBytes, arguments = MaxLengthBytesArgs ++ OverflowArgs}),
10841093
#'confirm.select_ok'{} = amqp_channel:call(Ch, #'confirm.select'{}),
@@ -1100,8 +1109,6 @@ max_length_drop_publish(Config) ->
11001109
MaxLengthArgs = [{<<"x-max-length">>, long, 1}],
11011110
MaxLengthBytesArgs = [{<<"x-max-length-bytes">>, long, 100}],
11021111
OverflowArgs = [{<<"x-overflow">>, longstr, <<"reject-publish">>}],
1103-
amqp_channel:call(Ch, #'queue.delete'{queue = QName}),
1104-
amqp_channel:call(Ch, #'queue.delete'{queue = QNameBytes}),
11051112
#'queue.declare_ok'{} = amqp_channel:call(Ch, #'queue.declare'{queue = QName, arguments = MaxLengthArgs ++ OverflowArgs}),
11061113
#'queue.declare_ok'{} = amqp_channel:call(Ch, #'queue.declare'{queue = QNameBytes, arguments = MaxLengthBytesArgs ++ OverflowArgs}),
11071114
%% If confirms are not enable, publishes will still be dropped in reject-publish mode.

0 commit comments

Comments
 (0)