Skip to content

Commit 187fa20

Browse files
committed
Fix cli tests
1 parent 48f5593 commit 187fa20

11 files changed

+9
-551
lines changed

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: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,6 @@ defmodule RabbitMQ.CLI.Queues.Commands.GrowCommand do
147147
"?"
148148
end
149149

150-
def output({:error, :not_found}, %{vhost: vhost, formatter: "json"}) do
151-
{:error,
152-
%{
153-
"result" => "error",
154-
"message" => "Target queue was not found in virtual host '#{vhost}'"
155-
}}
156-
end
157-
158150
defp format_size({:error, size, _}) do
159151
size
160152
end

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

scripts/bash_autocomplete.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

scripts/rabbitmq-script-wrapper

Lines changed: 0 additions & 111 deletions
This file was deleted.

0 commit comments

Comments
 (0)