Skip to content

Commit

Permalink
Handle errors in crashing_queues_SUITE
Browse files Browse the repository at this point in the history
As the connection may crash during the previous declaration and a caught
error would be returned in amqp_connection:open_channel/1 that wasn't
handled previously. Exactly how things fail in this test is most likely
very timing dependent and may vary.

Also fixes mqtt test where the process that set up a mock auth ETS table
was transient when an rpc timeout was introduced
  • Loading branch information
kjnilsson committed Dec 3, 2020
1 parent 3a16d1f commit 8f5e5ce
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
4 changes: 3 additions & 1 deletion deps/rabbit/test/per_user_connection_channel_limit_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,9 @@ open_channels(Conn, N) ->

open_channel(Conn) when is_pid(Conn) ->
try amqp_connection:open_channel(Conn) of
{ok, Ch} -> Ch
{ok, Ch} -> Ch;
{error, _} ->
{error, not_allowed}
catch
_:_Error -> {error, not_allowed}
end.
Expand Down
9 changes: 8 additions & 1 deletion deps/rabbitmq_mqtt/test/auth_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,14 @@ connect_ssl(Config) ->

client_id_propagation(Config) ->
ok = rabbit_ct_broker_helpers:add_code_path_to_all_nodes(Config,
rabbit_auth_backend_mqtt_mock),
rabbit_auth_backend_mqtt_mock),
%% setup creates the ETS table required for the mqtt auth mock
%% it blocks indefinitely so we need to spawn
_ = spawn(fun () ->
rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_auth_backend_mqtt_mock,
setup,
[])
end),
ClientId = <<"client-id-propagation">>,
{ok, C} = connect_user(<<"client-id-propagation">>, <<"client-id-propagation">>,
Config, ClientId),
Expand Down
11 changes: 9 additions & 2 deletions deps/rabbitmq_mqtt/test/rabbit_auth_backend_mqtt_mock.erl
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,20 @@
-behaviour(rabbit_authn_backend).
-behaviour(rabbit_authz_backend).

-export([user_login_authentication/2, user_login_authorization/2,
-export([setup/0,
user_login_authentication/2, user_login_authorization/2,
check_vhost_access/3, check_resource_access/4, check_topic_access/4,
state_can_expire/0,
get/1]).

user_login_authentication(_, AuthProps) ->
setup() ->
ets:new(?MODULE, [set, public, named_table]),
receive
stop -> ok
end.


user_login_authentication(_, AuthProps) ->
ets:insert(?MODULE, {authentication, AuthProps}),
{ok, #auth_user{username = <<"dummy">>,
tags = [],
Expand Down

0 comments on commit 8f5e5ce

Please sign in to comment.