Skip to content

Commit 4cb2b99

Browse files
Merge pull request #8840 from rabbitmq/mergify/bp/v3.11.x/pr-8839
Fix default topic exchange stomp test (backport #8838) (backport #8839)
2 parents 07c927c + f082dec commit 4cb2b99

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

deps/rabbitmq_stomp/test/topic_SUITE.erl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,18 +137,25 @@ subscribe_topic_authorisation(Config) ->
137137

138138
change_default_topic_exchange(Config) ->
139139
Channel = ?config(amqp_channel, Config),
140-
ClientFoo = ?config(client_foo, Config),
140+
Version = ?config(version, Config),
141+
StompPort = rabbit_ct_broker_helpers:get_node_config(Config, 0, tcp_port_stomp),
141142
Ex = <<"my-topic-exchange">>,
143+
ok = rabbit_ct_broker_helpers:rpc(Config, 0, application, set_env, [rabbitmq_stomp, default_topic_exchange, Ex]),
144+
{ok, ClientFoo} = rabbit_stomp_client:connect(Version, StompPort),
142145
AuthorisedTopic = "/topic/user.AuthorisedTopic",
143146

144147
Declare = #'exchange.declare'{exchange = Ex, type = <<"topic">>},
145148
#'exchange.declare_ok'{} = amqp_channel:call(Channel, Declare),
146149

147-
ok = rabbit_ct_broker_helpers:rpc(Config, 0, application, set_env, [rabbitmq_stomp, default_topic_exchange, Ex]),
150+
0 = length(rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_binding, list_for_source, [#resource{virtual_host= <<"/">>, kind = exchange, name = Ex}])),
148151

149152
rabbit_stomp_client:send(
150153
ClientFoo, "SUBSCRIBE", [{"destination", AuthorisedTopic}]),
151154

155+
timer:sleep(500),
156+
157+
1 = length(rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_binding, list_for_source, [#resource{virtual_host= <<"/">>, kind = exchange, name = Ex}])),
158+
152159
rabbit_stomp_client:send(
153160
ClientFoo, "SEND", [{"destination", AuthorisedTopic}], ["ohai there"]),
154161

@@ -158,6 +165,7 @@ change_default_topic_exchange(Config) ->
158165
Delete = #'exchange.delete'{exchange = Ex},
159166
#'exchange.delete_ok'{} = amqp_channel:call(Channel, Delete),
160167
ok = rabbit_ct_broker_helpers:rpc(Config, 0, application, unset_env, [rabbitmq_stomp, default_topic_exchange]),
168+
rabbit_stomp_client:disconnect(ClientFoo),
161169
ok.
162170

163171

0 commit comments

Comments
 (0)