Queues with plugins - fix rabbit_registry_SUITE

This commit is contained in:
Diana Parra Corbacho 2025-03-24 11:32:04 +01:00 committed by Iliia Khaprov
parent 59701a0ea9
commit cfd51bac6c
No known key found for this signature in database
GPG Key ID: 4DCFF8F358E49AED
2 changed files with 36 additions and 19 deletions

View File

@ -10,7 +10,6 @@
-include_lib("eunit/include/eunit.hrl").
-include_lib("common_test/include/ct.hrl").
-include_lib("amqp_client/include/amqp_client.hrl").
-include_lib("rabbit/include/mc.hrl").
-compile(export_all).
@ -55,31 +54,31 @@ end_per_testcase(_Testcase, Config) ->
%% Testcases.
%% -------------------------------------------------------------------
lookup_type_module(Config) ->
?assertMatch({error, not_found}, rabbit_registry:lookup_type_module(queue, <<"classic">>)),
?assertMatch({error, not_found}, rabbit_registry:lookup_type_module(queue, classic)),
?assertMatch({error, not_found}, rabbit_registry:lookup_type_module(queue, rabbit_classic_queue)),
lookup_type_module(_Config) ->
?assertMatch({error, not_found}, rabbit_registry:lookup_type_module(runtime_parameter, <<"param">>)),
?assertMatch({error, not_found}, rabbit_registry:lookup_type_module(runtime_parameter, param)),
?assertMatch({error, not_found}, rabbit_registry:lookup_type_module(runtime_parameter, runtime_parameter_test)),
ok = rabbit_registry:register(queue, <<"classic">>, rabbit_classic_queue),
ok = rabbit_registry:register(runtime_parameter, <<"param">>, rabbit_runtime_parameter_registry_test),
?assertMatch({ok, rabbit_classic_queue}, rabbit_registry:lookup_type_module(queue, <<"classic">>)),
?assertMatch({ok, rabbit_classic_queue}, rabbit_registry:lookup_type_module(queue, classic)),
?assertMatch({ok, rabbit_classic_queue}, rabbit_registry:lookup_type_module(queue, rabbit_classic_queue)),
?assertMatch({ok, rabbit_runtime_parameter_registry_test}, rabbit_registry:lookup_type_module(runtime_parameter, <<"param">>)),
?assertMatch({ok, rabbit_runtime_parameter_registry_test}, rabbit_registry:lookup_type_module(runtime_parameter, param)),
?assertMatch({ok, rabbit_runtime_parameter_registry_test}, rabbit_registry:lookup_type_module(runtime_parameter, rabbit_runtime_parameter_registry_test)),
?assertMatch({error, not_found}, rabbit_registry:lookup_type_module(queue, quorum)).
?assertMatch({error, not_found}, rabbit_registry:lookup_type_module(runtime_parameter, another_param)).
lookup_type_name(Config) ->
?assertMatch({error, not_found}, rabbit_registry:lookup_type_name(queue, <<"classic">>)),
?assertMatch({error, not_found}, rabbit_registry:lookup_type_module(queue, classic)),
?assertMatch({error, not_found}, rabbit_registry:lookup_type_module(queue, rabbit_classic_queue)),
lookup_type_name(_Config) ->
?assertMatch({error, not_found}, rabbit_registry:lookup_type_name(runtime_parameter, <<"param">>)),
?assertMatch({error, not_found}, rabbit_registry:lookup_type_module(runtime_parameter, param)),
?assertMatch({error, not_found}, rabbit_registry:lookup_type_module(runtime_parameter, runtime_parameter_test)),
ok = rabbit_registry:register(queue, <<"classic">>, rabbit_classic_queue),
ok = rabbit_registry:register(runtime_parameter, <<"param">>, rabbit_runtime_parameter_registry_test),
?assertMatch({ok, <<"classic">>}, rabbit_registry:lookup_type_name(queue, <<"classic">>)),
?assertMatch({ok, <<"classic">>}, rabbit_registry:lookup_type_name(queue, classic)),
?assertMatch({ok, <<"classic">>}, rabbit_registry:lookup_type_name(queue, rabbit_classic_queue)),
?assertMatch({ok, <<"param">>}, rabbit_registry:lookup_type_name(runtime_parameter, <<"param">>)),
?assertMatch({ok, <<"param">>}, rabbit_registry:lookup_type_name(runtime_parameter, param)),
?assertMatch({ok, <<"param">>}, rabbit_registry:lookup_type_name(runtime_parameter, rabbit_runtime_parameter_registry_test)),
?assertMatch({error, not_found}, rabbit_registry:lookup_type_name(queue, quorum)).
?assertMatch({error, not_found}, rabbit_registry:lookup_type_name(runtime_parameter, another_param)).
%% -------------------------------------------------------------------

View File

@ -0,0 +1,18 @@
-module(rabbit_runtime_parameter_registry_test).
-behaviour(rabbit_runtime_parameter).
-export([
validate/5,
notify/5,
notify_clear/4
]).
validate(_, _, _, _, _) ->
ok.
notify(_, _, _, _, _) ->
ok.
notify_clear(_, _, _, _) ->
ok.