Skip to content

Commit 7d64f31

Browse files
mc_mqtt_SUITE test for #12707 #12710
1 parent 767973b commit 7d64f31

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

deps/rabbitmq_mqtt/test/mc_mqtt_SUITE.erl

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ groups() ->
3333
mqtt_amqp,
3434
mqtt_amqp_alt,
3535
amqp_mqtt,
36-
is_persistent
36+
is_persistent,
37+
amqpl_to_mqtt_gh_12707
3738
]}
3839
].
3940

@@ -160,6 +161,34 @@ roundtrip_amqpl(_Config) ->
160161
ExpectedUserProperty = lists:keysort(1, UserProperty),
161162
?assertMatch(#{'User-Property' := ExpectedUserProperty}, Props).
162163

164+
amqpl_to_mqtt_gh_12707(_Config) ->
165+
Props = #'P_basic'{content_type = <<"text/plain">>,
166+
content_encoding = <<"gzip">>,
167+
headers = [],
168+
delivery_mode = 1,
169+
priority = 7,
170+
correlation_id = <<"gh_12707-corr">> ,
171+
reply_to = <<"reply-to">>,
172+
expiration = <<"12707">>,
173+
message_id = <<"msg-id">>,
174+
timestamp = 99,
175+
type = <<"45">>,
176+
user_id = <<"gh_12707">>,
177+
app_id = <<"rmq">>
178+
},
179+
Payload = [<<"gh_12707">>],
180+
Content = #content{properties = Props,
181+
payload_fragments_rev = Payload},
182+
Content = #content{properties = Props,
183+
payload_fragments_rev = Payload},
184+
Anns = #{
185+
?ANN_EXCHANGE => <<"amq.topic">>,
186+
?ANN_ROUTING_KEYS => [<<"dummy">>]
187+
},
188+
OriginalMsg = mc:init(mc_amqpl, Content, Anns),
189+
Converted = mc:convert(mc_mqtt, OriginalMsg),
190+
?assertEqual(12707, mc:get_annotation(ttl, Converted)).
191+
163192
%% Non-UTF-8 Correlation Data should also be converted (via AMQP 0.9.1 header x-correlation-id).
164193
roundtrip_amqpl_correlation(_Config) ->
165194
Msg0 = mqtt_msg(),

0 commit comments

Comments
 (0)