Skip to content

Commit a5f97b1

Browse files
deadtrickstermergify[bot]
authored andcommitted
Fix default topic exchange stomp test
The exchange setting is frozen per connection so it must be set before client connects. Also add indirect check set exchange is actually used. We check new binding was added after SUBSCRIBE frame. TODO: currently accepts any exchange type, fix that. (cherry picked from commit ad5241f) (cherry picked from commit 3506b1c)
1 parent 07c927c commit a5f97b1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

deps/rabbitmq_stomp/test/topic_SUITE.erl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,18 +137,23 @@ 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+
1 = length(rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_binding, list_for_source, [#resource{virtual_host= <<"/">>, kind = exchange, name = Ex}])),
156+
152157
rabbit_stomp_client:send(
153158
ClientFoo, "SEND", [{"destination", AuthorisedTopic}], ["ohai there"]),
154159

@@ -158,6 +163,7 @@ change_default_topic_exchange(Config) ->
158163
Delete = #'exchange.delete'{exchange = Ex},
159164
#'exchange.delete_ok'{} = amqp_channel:call(Channel, Delete),
160165
ok = rabbit_ct_broker_helpers:rpc(Config, 0, application, unset_env, [rabbitmq_stomp, default_topic_exchange]),
166+
rabbit_stomp_client:disconnect(ClientFoo),
161167
ok.
162168

163169

0 commit comments

Comments
 (0)