Skip to content

Commit

Permalink
Resolve conflicts #11496 #11522
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelklishin committed Jun 22, 2024
1 parent 947413a commit cc67592
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 79 deletions.
38 changes: 16 additions & 22 deletions deps/rabbitmq_management/test/clustering_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ ha_queue_hosted_on_other_node(Config) ->
consume(Chan, <<"ha-queue">>),

timer:sleep(5100),
force_stats(),
force_stats(Config),
Res = http_get(Config, "/queues/%2F/ha-queue"),

% assert some basic data is there
Expand Down Expand Up @@ -214,13 +214,13 @@ ha_queue_with_multiple_consumers(Config) ->
_ = wait_for_mirrored_queue(Config, "/queues/%2F/ha-queue3"),

consume(Chan, <<"ha-queue3">>),
force_stats(),
force_stats(Config),

{ok, Chan2} = amqp_connection:open_channel(?config(conn, Config)),
consume(Chan2, <<"ha-queue3">>),

timer:sleep(5100),
force_stats(),
force_stats(Config),

Res = http_get(Config, "/queues/%2F/ha-queue3"),

Expand Down Expand Up @@ -947,36 +947,30 @@ trace_fun(Config, MFs) ->
[ dbg:tpl(M, F, cx) || {M, F} <- MFs],
[ dbg:tpl(M, F, A, cx) || {M, F, A} <- MFs].

dump_table(Config, Table) ->
Data = rabbit_ct_broker_helpers:rpc(Config, 0, ets, tab2list, [Table]),
ct:pal(?LOW_IMPORTANCE, "Node 0: Dump of table ~tp:~n~tp~n", [Table, Data]),
Data0 = rabbit_ct_broker_helpers:rpc(Config, 1, ets, tab2list, [Table]),
ct:pal(?LOW_IMPORTANCE, "Node 1: Dump of table ~tp:~n~tp~n", [Table, Data0]).

force_stats(Config) ->
Nodes = rabbit_ct_broker_helpers:get_node_configs(Config, nodename),
force_all(Nodes),
ok.

force_all(Nodes) ->
lists:append(
[begin
ExtStats = {rabbit_mgmt_external_stats, N},
ExtStats ! emit_update,
[ExtStats |
[begin
ExtStats = {rabbit_mgmt_external_stats, N},
ExtStats ! emit_update,
[ExtStats |
[begin
Name = {rabbit_mgmt_metrics_collector:name(Table), N},
Name ! collect_metrics,
Name
end
|| {Table, _} <- ?CORE_TABLES]]
end || N <- Nodes]).
Name = {rabbit_mgmt_metrics_collector:name(Table), N},
Name ! collect_metrics,
Name
end
|| {Table, _} <- ?CORE_TABLES]]
end || N <- Nodes]).

send_to_all_collectors(Msg) ->
[begin
[{rabbit_mgmt_metrics_collector:name(Table), N} ! Msg
|| {Table, _} <- ?CORE_TABLES]
end || N <- [node() | nodes()]].
[{rabbit_mgmt_metrics_collector:name(Table), N} ! Msg
|| {Table, _} <- ?CORE_TABLES]
end || N <- [node() | nodes()]].

listener_protos(Listeners) ->
[listener_proto(L) || L <- Listeners].
Expand Down
52 changes: 5 additions & 47 deletions deps/rabbitmq_management/test/rabbit_mgmt_http_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@

-import(rabbit_ct_client_helpers, [close_connection/1, close_channel/1,
open_unmanaged_connection/1]).
-import(rabbit_ct_broker_helpers, [rpc/4]).
-import(rabbit_ct_helpers,
[eventually/3,
eventually/1]).
-import(rabbit_mgmt_test_util, [assert_list/2, assert_item/2, test_item/2,
assert_keys/2, assert_no_keys/2,
http_get/2, http_get/3, http_get/5,
Expand All @@ -35,14 +39,10 @@
-define(COLLECT_INTERVAL, 256).
-define(PATH_PREFIX, "/custom-prefix").

<<<<<<< HEAD
-compile(export_all).
=======
-define(AWAIT(Body),
await_condition(fun () -> Body end)).

-compile([export_all, nowarn_export_all]).
>>>>>>> a9ac9c46cf (rabbitmq_management: speed up rabbit_mgmt_http_SUITE.erl)

all() ->
[
Expand Down Expand Up @@ -454,7 +454,7 @@ auth_test(Config) ->
%% NOTE: this one won't have www-authenticate in the response,
%% because user/password are ok, tags are not
test_auth(Config, ?NOT_AUTHORISED, [auth_header("user", "user")]),
WrongAuthResponseHeaders = test_auth(Config, ?NOT_AUTHORISED, [auth_header("guest", "gust")]),
test_auth(Config, ?NOT_AUTHORISED, [auth_header("guest", "gust")]),
%?assertEqual(true, lists:keymember("www-authenticate", 1, WrongAuthResponseHeaders)),
test_auth(Config, ?OK, [auth_header("guest", "guest")]),
http_delete(Config, "/users/user", {group, '2xx'}),
Expand Down Expand Up @@ -2199,12 +2199,6 @@ exchanges_pagination_test(Config) ->
http_put(Config, "/exchanges/%2F/test2_reg", QArgs, {group, '2xx'}),
http_put(Config, "/exchanges/vh1/reg_test3", QArgs, {group, '2xx'}),

<<<<<<< HEAD
%% for stats to update
timer:sleep(1500),

Total = length(rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_exchange, list_names, [])),
=======
Total = length(rpc(Config, rabbit_exchange, list_names, [])),
await_condition(
fun () ->
Expand All @@ -2218,7 +2212,6 @@ exchanges_pagination_test(Config) ->
assert_list([#{name => <<"">>, vhost => <<"/">>},
#{name => <<"amq.direct">>, vhost => <<"/">>}
], maps:get(items, PageOfTwo)),
>>>>>>> a9ac9c46cf (rabbitmq_management: speed up rabbit_mgmt_http_SUITE.erl)

ByName = http_get(Config, "/exchanges?page=1&page_size=2&name=reg", ?OK),
?assertEqual(Total, maps:get(total_count, ByName)),
Expand Down Expand Up @@ -2314,31 +2307,6 @@ queue_pagination_test(Config) ->
begin
Total = length(rpc(Config, rabbit_amqqueue, list_names, [])),

<<<<<<< HEAD
Total = length(rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_amqqueue, list_names, [])),

PageOfTwo = http_get(Config, "/queues?page=1&page_size=2", ?OK),
?assertEqual(Total, maps:get(total_count, PageOfTwo)),
?assertEqual(Total, maps:get(filtered_count, PageOfTwo)),
?assertEqual(2, maps:get(item_count, PageOfTwo)),
?assertEqual(1, maps:get(page, PageOfTwo)),
?assertEqual(2, maps:get(page_size, PageOfTwo)),
?assertEqual(2, maps:get(page_count, PageOfTwo)),
assert_list([#{name => <<"test0">>, vhost => <<"/">>, storage_version => 1},
#{name => <<"test2_reg">>, vhost => <<"/">>, storage_version => 1}
], maps:get(items, PageOfTwo)),

SortedByName = http_get(Config, "/queues?sort=name&page=1&page_size=2", ?OK),
?assertEqual(Total, maps:get(total_count, SortedByName)),
?assertEqual(Total, maps:get(filtered_count, SortedByName)),
?assertEqual(2, maps:get(item_count, SortedByName)),
?assertEqual(1, maps:get(page, SortedByName)),
?assertEqual(2, maps:get(page_size, SortedByName)),
?assertEqual(2, maps:get(page_count, SortedByName)),
assert_list([#{name => <<"reg_test3">>, vhost => <<"vh1">>},
#{name => <<"test0">>, vhost => <<"/">>}
], maps:get(items, SortedByName)),
=======
PageOfTwo = http_get(Config, "/queues?page=1&page_size=2", ?OK),
?assertEqual(Total, maps:get(total_count, PageOfTwo)),
?assertEqual(Total, maps:get(filtered_count, PageOfTwo)),
Expand All @@ -2360,7 +2328,6 @@ queue_pagination_test(Config) ->
assert_list([#{name => <<"reg_test3">>, vhost => <<"vh1">>},
#{name => <<"test0">>, vhost => <<"/">>}
], maps:get(items, SortedByName)),
>>>>>>> a9ac9c46cf (rabbitmq_management: speed up rabbit_mgmt_http_SUITE.erl)


FirstPage = http_get(Config, "/queues?page=1", ?OK),
Expand Down Expand Up @@ -2722,14 +2689,6 @@ format_output_test(Config) ->
http_put(Config, "/vhosts/vh129", none, {group, '2xx'}),
http_put(Config, "/permissions/vh129/guest", PermArgs, {group, '2xx'}),
http_put(Config, "/queues/%2F/test0", QArgs, {group, '2xx'}),
<<<<<<< HEAD
timer:sleep(2000),
assert_list([#{name => <<"test0">>,
consumer_capacity => 0,
consumer_utilisation => 0,
exclusive_consumer_tag => null,
recoverable_slaves => null}], http_get(Config, "/queues", ?OK)),
=======

?AWAIT(
begin
Expand All @@ -2739,7 +2698,6 @@ format_output_test(Config) ->
exclusive_consumer_tag => null}], http_get(Config, "/queues", ?OK)),
true
end),
>>>>>>> a9ac9c46cf (rabbitmq_management: speed up rabbit_mgmt_http_SUITE.erl)
http_delete(Config, "/queues/%2F/test0", {group, '2xx'}),
http_delete(Config, "/vhosts/vh129", {group, '2xx'}),
passed.
Expand Down
5 changes: 0 additions & 5 deletions deps/rabbitmq_management/test/rabbit_mgmt_only_http_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,10 @@ some_tests() ->
vhosts_test,
connections_test,
exchanges_test,
<<<<<<< HEAD
queues_test,
mirrored_queues_test,
=======
queues_test
].

all_tests() -> [
>>>>>>> 51033093fd (speed up more)
quorum_queues_test,
permissions_vhost_test,
permissions_connection_channel_consumer_test,
Expand Down
5 changes: 0 additions & 5 deletions deps/rabbitmq_management/test/rabbit_mgmt_test_db_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
-include_lib("common_test/include/ct.hrl").
-include_lib("rabbit_common/include/rabbit_core_metrics.hrl").
-include_lib("rabbitmq_management_agent/include/rabbit_mgmt_records.hrl").
<<<<<<< HEAD
-include_lib("rabbitmq_management_agent/include/rabbit_mgmt_metrics.hrl").
-include("rabbit_mgmt.hrl").
=======
>>>>>>> de821c33f8 (rabbitmq_management: speed up rabbit_mgmt_test_db_SUITE.erl)
-include_lib("rabbitmq_ct_helpers/include/rabbit_mgmt_test.hrl").
-import(rabbit_mgmt_test_util, [assert_list/2,
reset_management_settings/1]).
Expand Down

0 comments on commit cc67592

Please sign in to comment.