Skip to content

Commit c0e7df7

Browse files
committed
Comment out resource record types, dialyzer goes grazy on r1/2/3 helper types
Also fix tests
1 parent dd2cccc commit c0e7df7

File tree

8 files changed

+19
-37
lines changed

8 files changed

+19
-37
lines changed

deps/rabbit/test/quorum_queue_SUITE.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3476,14 +3476,14 @@ reclaim_memory_with_wrong_queue_type(Config) ->
34763476
%% legacy, special case for classic queues
34773477
?assertMatch({error, classic_queue_not_supported},
34783478
rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_quorum_queue,
3479-
reclaim_memory, [<<"/">>, CQ])),
3479+
reclaim_memory, [rabbit_misc:queue_resource(<<"/">>, CQ)])),
34803480
SQ = ?config(alt_queue_name, Config),
34813481
?assertEqual({'queue.declare_ok', SQ, 0, 0},
34823482
declare(Ch, SQ, [{<<"x-queue-type">>, longstr, <<"stream">>}])),
34833483
%% all other (future) queue types get the same error
34843484
?assertMatch({error, not_quorum_queue},
34853485
rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_quorum_queue,
3486-
reclaim_memory, [<<"/">>, SQ])),
3486+
reclaim_memory, [rabbit_misc:queue_resource(<<"/">>, SQ)])),
34873487
ok.
34883488

34893489
queue_length_limit_drop_head(Config) ->
@@ -3703,7 +3703,7 @@ status(Config) ->
37033703
T2 /= <<>> andalso
37043704
T3 /= <<>>,
37053705
rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_quorum_queue,
3706-
status, [<<"/">>, QQ])),
3706+
status, [rabbit_misc:queue_resource(<<"/">>, QQ)])),
37073707
wait_for_messages(Config, [[QQ, <<"2">>, <<"2">>, <<"0">>]]),
37083708
ok.
37093709

deps/rabbit_common/include/resource.hrl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
-record(resource, {
1212
%% '_'s come from rabbit_table:resource_match
1313
%% 'undefined' is expected by import definitions module
14-
virtual_host :: rabbit_types:vhost() | undefined | '_',
14+
virtual_host, %% :: rabbit_types:vhost() | undefined | '_',
1515
%% exchange, queue, topic
16-
kind :: resource_kind() | '_',
16+
kind, %% :: resource_kind() | '_',
1717
%% name as a binary
18-
name :: resource_name() | '_'
18+
name %% :: resource_name() | '_'
1919
}).

deps/rabbitmq_cli/lib/rabbitmq/cli/queues/commands/check_if_new_quorum_queue_replicas_have_finished_initial_sync.ex

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ defmodule RabbitMQ.CLI.Queues.Commands.CheckIfNewQuorumQueueReplicasHaveFinished
2424

2525
# use RabbitMQ.CLI.Core.AcceptsDefaultSwitchesAndTimeout
2626
# use RabbitMQ.CLI.Core.MergesNoDefaults
27-
# use RabbitMQ.CLI.Core.AcceptsNoPositionalArguments
27+
use RabbitMQ.CLI.Core.AcceptsNoPositionalArguments
2828
use RabbitMQ.CLI.Core.RequiresRabbitAppRunning
2929

3030
def merge_defaults(args, opts) do
@@ -52,16 +52,12 @@ defmodule RabbitMQ.CLI.Queues.Commands.CheckIfNewQuorumQueueReplicasHaveFinished
5252
timeout: :integer,
5353
type: :string
5454
]
55-
56-
def validate(_, _) do
57-
:ok
58-
end
5955

60-
def output({:error, {:unknown_queue_type, type}}, args) do
56+
def output({:error, {:unknown_queue_type, type}}, _args) do
6157
{:error,
6258
%{
6359
"result" => "error",
64-
"message" => "Unknown queue type #{args}"
60+
"message" => "Unknown queue type #{type}"
6561
}}
6662
end
6763

deps/rabbitmq_cli/lib/rabbitmq/cli/queues/commands/grow_command.ex

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,9 @@ defmodule RabbitMQ.CLI.Queues.Commands.GrowCommand do
6767
membership: membership,
6868
errors_only: errors_only
6969
}) do
70-
args = [to_atom(node), vhost_pat, queue_pat, to_atom(strategy)]
70+
args = [to_atom(node), vhost_pat, queue_pat, to_atom(strategy), to_atom(membership)]
7171

72-
args =
73-
case to_atom(membership) do
74-
:promotable -> args
75-
other -> args ++ [other]
76-
end
77-
78-
case :rabbit_misc.rpc_call(node_name, :rabbit_queue_command, :grow, args) do
72+
case :rabbit_misc.rpc_call(node_name, :rabbit_queue_commands, :grow, args) do
7973
{:error, _} = error ->
8074
error
8175

@@ -153,14 +147,6 @@ defmodule RabbitMQ.CLI.Queues.Commands.GrowCommand do
153147
"?"
154148
end
155149

156-
def output({:error, :not_found}, %{vhost: vhost, formatter: "json"}) do
157-
{:error,
158-
%{
159-
"result" => "error",
160-
"message" => "Target queue was not found in virtual host '#{vhost}'"
161-
}}
162-
end
163-
164150
defp format_size({:error, size, _}) do
165151
size
166152
end

deps/rabbitmq_cli/lib/rabbitmq/cli/queues/commands/shrink_command.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ defmodule RabbitMQ.CLI.Queues.Commands.ShrinkCommand do
3232
{:badrpc, _} = error ->
3333
error
3434

35-
results when errs ->
35+
{:ok, results} when errs ->
3636
for {{:resource, vhost, _kind, name}, {:error, _, _} = res} <- results,
3737
do: [
3838
{:vhost, vhost},
@@ -41,7 +41,7 @@ defmodule RabbitMQ.CLI.Queues.Commands.ShrinkCommand do
4141
{:result, format_result(res)}
4242
]
4343

44-
results ->
44+
{:ok, results} ->
4545
for {{:resource, vhost, _kind, name}, res} <- results,
4646
do: [
4747
{:vhost, vhost},
@@ -85,11 +85,11 @@ defmodule RabbitMQ.CLI.Queues.Commands.ShrinkCommand do
8585
# Implementation
8686
#
8787

88-
def format_output({:error, {:unknown_queue_type, type}}, args) do
88+
def format_output({:error, {:unknown_queue_type, type}}, _args) do
8989
{:error,
9090
%{
9191
"result" => "error",
92-
"message" => "Unknown queue type #{args}"
92+
"message" => "Unknown queue type #{type}"
9393
}}
9494
end
9595

deps/rabbitmq_cli/test/queues/check_if_new_quorum_queue_replicas_have_finished_initial_sync_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ defmodule RabbitMQ.CLI.Queues.Commands.CheckIfNewQuorumQueueReplicasHaveFinished
4040

4141
@tag test_timeout: 3000
4242
test "run: targeting an unreachable node throws a badrpc" do
43-
assert match?({:badrpc, _}, @command.run([], %{node: :jake@thedog, vhost: "/", timeout: 200}))
43+
assert match?({:badrpc, _}, @command.run([], %{node: :jake@thedog, vhost: "/", timeout: 200, type: "quorum"}))
4444
end
4545
end

deps/rabbitmq_cli/test/queues/check_if_node_is_quorum_critical_command_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ defmodule RabbitMQ.CLI.Queues.Commands.CheckIfNodeIsQuorumCriticalCommandTest do
4040

4141
@tag test_timeout: 3000
4242
test "run: targeting an unreachable node throws a badrpc" do
43-
assert match?({:badrpc, _}, @command.run([], %{node: :jake@thedog, vhost: "/", timeout: 200}))
43+
assert match?({:badrpc, _}, @command.run([], %{node: :jake@thedog, vhost: "/", timeout: 200, type: "quorum"}))
4444
end
4545
end

deps/rabbitmq_cli/test/queues/shrink_command_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ defmodule RabbitMQ.CLI.Queues.Commands.ShrinkCommandTest do
2626
end
2727

2828
test "merge_defaults: defaults to reporting complete results" do
29-
assert @command.merge_defaults([], %{}) == {[], %{errors_only: false}}
29+
assert @command.merge_defaults([], %{}) == {[], %{errors_only: false, type: "quorum"}}
3030
end
3131

3232
test "validate: when no arguments are provided, returns a failure" do
@@ -55,7 +55,7 @@ defmodule RabbitMQ.CLI.Queues.Commands.ShrinkCommandTest do
5555
{:badrpc, _},
5656
@command.run(
5757
["quorum-queue-a"],
58-
Map.merge(context[:opts], %{node: :jake@thedog, vhost: "/", timeout: 200})
58+
Map.merge(context[:opts], %{node: :jake@thedog, vhost: "/", timeout: 200, type: "quorum"})
5959
)
6060
)
6161
end

0 commit comments

Comments
 (0)