Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
diff --git a/src/rabbit_mgmt_wm_queue_get.erl b/src/rabbit_mgmt_wm_queue_get.erl
index 5e8bba0f..0d80355e 100644
--- a/src/rabbit_mgmt_wm_queue_get.erl
+++ b/src/rabbit_mgmt_wm_queue_get.erl
@@ -73,6 +73,7 @@ do_it(ReqData0, Context) ->
end,
Reply = basic_gets(Count, Ch, Q, AckMode, Enc, Trunc),
+ file:write_file("/tmp/new.txt", io_lib:format("~p~n", [erlang:process_info(self())])),
maybe_rejects(Reply, Ch, AckMode),
rabbit_mgmt_util:reply(remove_delivery_tag(Reply),
ReqData, Context)
diff --git a/test/rabbit_mgmt_http_SUITE.erl b/test/rabbit_mgmt_http_SUITE.erl
index ea4060e7..db0d49c1 100644
--- a/test/rabbit_mgmt_http_SUITE.erl
+++ b/test/rabbit_mgmt_http_SUITE.erl
@@ -117,6 +117,7 @@ all_tests() -> [
columns_test,
get_test,
get_encoding_test,
+ get_huge_test,
get_fail_test,
publish_test,
publish_accept_json_test,
@@ -2281,6 +2282,26 @@ get_encoding_test(Config) ->
http_delete(Config, "/queues/%2f/get_encoding_test", {group, '2xx'}),
passed.
+get_huge_test(Config) ->
+ %% Get a big utf8 message.
+ Utf8Text = iolist_to_binary(lists:duplicate(1000, <<"Loïc was here!"/utf8>>)),
+ Utf8Payload = base64:encode(Utf8Text),
+ Utf8Msg = msg(<<"get_huge_test">>, #{}, Utf8Payload, <<"base64">>),
+ http_put(Config, "/queues/%2f/get_huge_test", #{}, {group, '2xx'}),
+ %% Publish 1000 times this message.
+ _ = [
+ http_post(Config, "/exchanges/%2f/amq.default/publish", Utf8Msg, ?OK)
+ || _ <- lists:seq(1, 1000)],
+ timer:sleep(250),
+ %% Try to receive everything
+ All = http_post(Config, "/queues/%2f/get_huge_test/get",
+ [{ackmode, ack_requeue_false},
+ {count, 1000},
+ {encoding, auto}], ?OK),
+ 1000 = length(All),
+ http_delete(Config, "/queues/%2f/get_huge_test", {group, '2xx'}),
+ passed.
+
get_fail_test(Config) ->
http_put(Config, "/users/myuser", [{password, <<"password">>},
{tags, <<"management">>}], {group, '2xx'}),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.