Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deps/rabbit/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ define ct_master.erl
endef

PARALLEL_CT_SET_1_A = amqp_client unit_cluster_formation_locking_mocks unit_cluster_formation_sort_nodes unit_collections unit_config_value_encryption unit_connection_tracking
PARALLEL_CT_SET_1_B = amqp_address amqp_auth amqp_credit_api_v2 amqp_filtex amqp_system signal_handling single_active_consumer unit_access_control_authn_authz_context_propagation unit_access_control_credential_validation unit_amqp091_content_framing unit_amqp091_server_properties unit_app_management
PARALLEL_CT_SET_1_B = amqp_address amqp_auth amqp_credit_api_v2 amqp_filtex amqp_dotnet amqp_jms signal_handling single_active_consumer unit_access_control_authn_authz_context_propagation unit_access_control_credential_validation unit_amqp091_content_framing unit_amqp091_server_properties unit_app_management
PARALLEL_CT_SET_1_C = amqp_proxy_protocol amqpl_consumer_ack amqpl_direct_reply_to backing_queue bindings rabbit_db_maintenance rabbit_db_msup rabbit_db_policy rabbit_db_queue rabbit_db_topic_exchange rabbit_direct_reply_to_prop cluster_limit cluster_minority term_to_binary_compat_prop topic_permission transactions unicode unit_access_control
PARALLEL_CT_SET_1_D = amqqueue_backward_compatibility channel_interceptor channel_operation_timeout classic_queue classic_queue_prop config_schema peer_discovery_dns peer_discovery_tmp_hidden_node per_node_limit per_user_connection_channel_limit

Expand Down
3 changes: 2 additions & 1 deletion deps/rabbit/ct.test.spec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
, amqp_credit_api_v2_SUITE
, amqp_filtex_SUITE
, amqp_proxy_protocol_SUITE
, amqp_system_SUITE
, amqp_dotnet_SUITE
, amqp_jms_SUITE
, amqpl_consumer_ack_SUITE
, amqpl_direct_reply_to_SUITE
, amqqueue_backward_compatibility_SUITE
Expand Down
165 changes: 55 additions & 110 deletions deps/rabbit/test/amqp_client_SUITE.erl

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,43 @@
%% Copyright (c) 2007-2025 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
%%

-module(amqp_system_SUITE).
-module(amqp_dotnet_SUITE).

-include_lib("common_test/include/ct.hrl").
-include_lib("eunit/include/eunit.hrl").
-include_lib("rabbit_common/include/rabbit_framing.hrl").

-compile(nowarn_export_all).
-compile(export_all).

all() ->
[
{group, dotnet},
{group, java}
{group, cluster_size_1}
].

groups() ->
[
{dotnet, [], [
roundtrip,
roundtrip_to_amqp_091,
default_outcome,
no_routes_is_released,
outcomes,
fragmentation,
message_annotations,
footer,
data_types,
%% TODO at_most_once,
reject,
redelivery,
released,
routing,
invalid_routes,
auth_failure,
access_failure_not_allowed,
access_failure_send,
streams
]},
{java, [], [
roundtrip
]}
].
[{cluster_size_1, [],
[
roundtrip,
roundtrip_to_amqp_091,
default_outcome,
no_routes_is_released,
outcomes,
fragmentation,
message_annotations,
footer,
data_types,
reject,
redelivery,
released,
routing,
invalid_routes,
auth_failure,
access_failure_not_allowed,
access_failure_send,
streams
]
}].

%% -------------------------------------------------------------------
%% Testsuite setup/teardown.
Expand All @@ -63,26 +59,20 @@ init_per_suite(Config) ->
end_per_suite(Config) ->
Config.

init_per_group(Group, Config) ->
init_per_group(cluster_size_1, Config) ->
Suffix = rabbit_ct_helpers:testcase_absname(Config, "", "-"),
Config1 = rabbit_ct_helpers:set_config(Config, [
{rmq_nodename_suffix, Suffix},
{amqp_client_library, Group}
]),
GroupSetupStep = case Group of
dotnet -> fun build_dotnet_test_project/1;
java -> fun build_maven_test_project/1
end,
Config1 = rabbit_ct_helpers:set_config(Config, {rmq_nodename_suffix, Suffix}),
Config2 = rabbit_ct_helpers:run_setup_steps(
Config1,
[GroupSetupStep] ++
[fun build_dotnet_test_project/1] ++
rabbit_ct_broker_helpers:setup_steps() ++
rabbit_ct_client_helpers:setup_steps()),
ok = rabbit_ct_broker_helpers:enable_feature_flag(Config2, 'rabbitmq_4.0.0'),
Config2.

end_per_group(_, Config) ->
rabbit_ct_helpers:run_teardown_steps(Config,
rabbit_ct_helpers:run_teardown_steps(
Config,
rabbit_ct_client_helpers:teardown_steps() ++
rabbit_ct_broker_helpers:teardown_steps()).

Expand All @@ -93,28 +83,14 @@ end_per_testcase(Testcase, Config) ->
rabbit_ct_helpers:testcase_finished(Config, Testcase).

build_dotnet_test_project(Config) ->
TestProjectDir = filename:join(
[?config(data_dir, Config), "fsharp-tests"]),
Ret = rabbit_ct_helpers:exec(["dotnet", "restore"],
[{cd, TestProjectDir}]),
case Ret of
TestProjectDir = filename:join([?config(data_dir, Config), "fsharp-tests"]),
case rabbit_ct_helpers:exec(["dotnet", "restore"],
[{cd, TestProjectDir}]) of
{ok, _} ->
rabbit_ct_helpers:set_config(
Config, {dotnet_test_project_dir, TestProjectDir});
_ ->
ct:fail({"'dotnet restore' failed", Ret})
end.

build_maven_test_project(Config) ->
TestProjectDir = filename:join([?config(data_dir, Config), "java-tests"]),
Ret = rabbit_ct_helpers:exec([TestProjectDir ++ "/mvnw", "test-compile"],
[{cd, TestProjectDir}]),
case Ret of
{ok, _} ->
rabbit_ct_helpers:set_config(Config,
{maven_test_project_dir, TestProjectDir});
_ ->
ct:fail({"'mvnw test-compile' failed", Ret})
Other ->
ct:fail({"'dotnet restore' failed", Other})
end.

%% -------------------------------------------------------------------
Expand All @@ -123,58 +99,53 @@ build_maven_test_project(Config) ->

roundtrip(Config) ->
declare_queue(Config, ?FUNCTION_NAME, "quorum"),
run(Config, [{dotnet, "roundtrip"},
{java, "RoundTripTest"}]).

streams(Config) ->
declare_queue(Config, ?FUNCTION_NAME, "stream"),
run(Config, [{dotnet, "streams"}]).
run(?FUNCTION_NAME, Config).

roundtrip_to_amqp_091(Config) ->
declare_queue(Config, ?FUNCTION_NAME, "classic"),
run(Config, [{dotnet, "roundtrip_to_amqp_091"}]).
run(?FUNCTION_NAME, Config).

default_outcome(Config) ->
declare_queue(Config, ?FUNCTION_NAME, "classic"),
run(Config, [{dotnet, "default_outcome"}]).
run(?FUNCTION_NAME, Config).

no_routes_is_released(Config) ->
Ch = rabbit_ct_client_helpers:open_channel(Config),
amqp_channel:call(Ch, #'exchange.declare'{exchange = <<"no_routes_is_released">>,
durable = true}),
run(Config, [{dotnet, "no_routes_is_released"}]).
run(?FUNCTION_NAME, Config).

outcomes(Config) ->
declare_queue(Config, ?FUNCTION_NAME, "classic"),
run(Config, [{dotnet, "outcomes"}]).
run(?FUNCTION_NAME, Config).

fragmentation(Config) ->
declare_queue(Config, ?FUNCTION_NAME, "classic"),
run(Config, [{dotnet, "fragmentation"}]).
run(?FUNCTION_NAME, Config).

message_annotations(Config) ->
declare_queue(Config, ?FUNCTION_NAME, "classic"),
run(Config, [{dotnet, "message_annotations"}]).
run(?FUNCTION_NAME, Config).

footer(Config) ->
declare_queue(Config, ?FUNCTION_NAME, "classic"),
run(Config, [{dotnet, "footer"}]).
run(?FUNCTION_NAME, Config).

data_types(Config) ->
declare_queue(Config, ?FUNCTION_NAME, "classic"),
run(Config, [{dotnet, "data_types"}]).
run(?FUNCTION_NAME, Config).

reject(Config) ->
declare_queue(Config, ?FUNCTION_NAME, "classic"),
run(Config, [{dotnet, "reject"}]).
run(?FUNCTION_NAME, Config).

redelivery(Config) ->
declare_queue(Config, ?FUNCTION_NAME, "quorum"),
run(Config, [{dotnet, "redelivery"}]).
run(?FUNCTION_NAME, Config).

released(Config) ->
declare_queue(Config, ?FUNCTION_NAME, "quorum"),
run(Config, [{dotnet, "released"}]).
run(?FUNCTION_NAME, Config).

routing(Config) ->
Ch = rabbit_ct_client_helpers:open_channel(Config),
Expand Down Expand Up @@ -203,23 +174,18 @@ routing(Config) ->
exchange = <<"amq.direct">>,
routing_key = <<"direct_q">>
}),

run(Config, [
{dotnet, "routing"}
]).
run(?FUNCTION_NAME, Config).

invalid_routes(Config) ->
run(Config, [
{dotnet, "invalid_routes"}
]).
run(?FUNCTION_NAME, Config).

auth_failure(Config) ->
run(Config, [ {dotnet, "auth_failure"} ]).
run(?FUNCTION_NAME, Config).

access_failure_not_allowed(Config) ->
User = atom_to_binary(?FUNCTION_NAME),
ok = rabbit_ct_broker_helpers:add_user(Config, User, <<"boo">>),
run(Config, [ {dotnet, "access_failure_not_allowed"} ]),
run(?FUNCTION_NAME, Config),
ok = rabbit_ct_broker_helpers:delete_user(Config, User).

access_failure_send(Config) ->
Expand All @@ -230,45 +196,35 @@ access_failure_send(Config) ->
<<"^banana.*">>, %% write
<<"^banana.*">> %% read
),
run(Config, [ {dotnet, "access_failure_send"} ]),
run(?FUNCTION_NAME, Config),
ok = rabbit_ct_broker_helpers:delete_user(Config, User).

run(Config, Flavors) ->
ClientLibrary = ?config(amqp_client_library, Config),
Fun = case ClientLibrary of
dotnet -> fun run_dotnet_test/2;
java -> fun run_java_test/2
end,
{ClientLibrary, TestName} = proplists:lookup(ClientLibrary, Flavors),
Fun(Config, TestName).
streams(Config) ->
declare_queue(Config, ?FUNCTION_NAME, "stream"),
run(?FUNCTION_NAME, Config).

run_dotnet_test(Config, Method) ->
TestProjectDir = ?config(dotnet_test_project_dir, Config),
Uri = rabbit_ct_broker_helpers:node_uri(Config, 0, [{use_ipaddr, true}]),
Ret = rabbit_ct_helpers:exec(["dotnet", "run", "--", Method, Uri ],
[
{cd, TestProjectDir}
]),
ct:pal("~s: result ~p", [?FUNCTION_NAME, Ret]),
{ok, _} = Ret.

run_java_test(Config, Class) ->
TestProjectDir = ?config(maven_test_project_dir, Config),
Ret = rabbit_ct_helpers:exec([
TestProjectDir ++ "/mvnw",
"test",
{"-Dtest=~ts", [Class]},
{"-Drmq_broker_uri=~ts", [rabbit_ct_broker_helpers:node_uri(Config, 0)]}
],
[{cd, TestProjectDir}]),
{ok, _} = Ret.
%% -------------------------------------------------------------------
%% Helpers
%% -------------------------------------------------------------------

declare_queue(Config, Name, Type) ->
Ch = rabbit_ct_client_helpers:open_channel(Config),
#'queue.declare_ok'{} =
amqp_channel:call(Ch, #'queue.declare'{queue = atom_to_binary(Name, utf8),
durable = true,
arguments = [{<<"x-queue-type">>,
longstr, Type}]}),
amqp_channel:call(Ch, #'queue.declare'{queue = atom_to_binary(Name, utf8),
durable = true,
arguments = [{<<"x-queue-type">>,
longstr, Type}]}),
rabbit_ct_client_helpers:close_channel(Ch),
ok.

run(TestNameAtom, Config) ->
TestName = atom_to_list(TestNameAtom),
TestProjectDir = ?config(dotnet_test_project_dir, Config),
Uri = rabbit_ct_broker_helpers:node_uri(Config, 0, [{use_ipaddr, true}]),
case rabbit_ct_helpers:exec(["dotnet", "run", "--", TestName, Uri],
[{cd, TestProjectDir}]) of
{ok, _Stdout_} ->
ok;
{error, _ExitCode, _Stdout} ->
ct:fail(TestName)
end.
Loading
Loading