Skip to content

Commit 0d4ee9d

Browse files
dcorbachomichaelklishin
authored andcommitted
Update rabbitmqctl tests for rename/update cluster nodes
1 parent 4fa900d commit 0d4ee9d

File tree

4 files changed

+7
-115
lines changed

4 files changed

+7
-115
lines changed

deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/rename_cluster_node_command.ex

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ defmodule RabbitMQ.CLI.Ctl.Commands.RenameClusterNodeCommand do
4444
end
4545

4646
def banner(_, _opts) do
47-
[
4847
"DEPRECATED. This command is a no-op. Node renaming is incompatible with Raft-based features such as quorum queues, streams, Khepri. "
49-
]
5048
end
51-
5249
end

deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/update_cluster_nodes_command.ex

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,10 @@ defmodule RabbitMQ.CLI.Ctl.Commands.UpdateClusterNodesCommand do
3838
def help_section(), do: :deprecated
3939

4040
def description() do
41-
"DEPRECATED. This command is a no-op. Node renaming is incompatible with Raft-based features such as quorum queues, streams, Khepri. "
41+
"DEPRECATED. This command is a no-op. Node update is incompatible with Raft-based features such as quorum queues, streams, Khepri. "
4242
end
4343

4444
def banner(_, _opts) do
45-
[
46-
"DEPRECATED. This command is a no-op. Node renaming is incompatible with Raft-based features such as quorum queues, streams, Khepri. "
47-
]
45+
"DEPRECATED. This command is a no-op. Node update is incompatible with Raft-based features such as quorum queues, streams, Khepri. "
4846
end
49-
end
47+
end

deps/rabbitmq_cli/test/ctl/rename_cluster_node_command_test.exs

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -38,65 +38,8 @@ defmodule RenameClusterNodeCommandTest do
3838
)}
3939
end
4040

41-
test "validate: specifying no nodes fails validation", context do
42-
assert @command.validate([], context[:opts]) ==
43-
{:validation_failure, :not_enough_args}
44-
end
45-
46-
test "validate: specifying one node only fails validation", context do
47-
assert @command.validate(["a"], context[:opts]) ==
48-
{:validation_failure, :not_enough_args}
49-
end
50-
51-
test "validate_execution_environment: specifying an uneven number of arguments fails validation",
52-
context do
53-
assert match?(
54-
{:validation_failure, {:bad_argument, _}},
55-
@command.validate_execution_environment(["a", "b", "c"], context[:opts])
56-
)
57-
end
58-
59-
test "validate_execution_environment: request to a running node fails", _context do
60-
node = get_rabbit_hostname()
61-
62-
assert match?(
63-
{:validation_failure, :node_running},
64-
@command.validate_execution_environment([to_string(node), "other_node@localhost"], %{
65-
node: node
66-
})
67-
)
68-
end
69-
70-
test "validate_execution_environment: not providing node data dir fails validation",
71-
context do
72-
opts_without_data_dir = Map.delete(context[:opts], :data_dir)
73-
Application.put_env(:rabbit, :data_dir, "/tmp")
74-
on_exit(fn -> Application.delete_env(:rabbit, :data_dir) end)
75-
76-
assert :ok ==
77-
@command.validate(
78-
["some_node@localhost", "other_node@localhost"],
79-
opts_without_data_dir
80-
)
81-
82-
Application.delete_env(:rabbit, :data_dir)
83-
System.put_env("RABBITMQ_MNESIA_DIR", "/tmp")
84-
on_exit(fn -> System.delete_env("RABBITMQ_MNESIA_DIR") end)
85-
86-
assert :ok ==
87-
@command.validate(
88-
["some_node@localhost", "other_node@localhost"],
89-
opts_without_data_dir
90-
)
91-
92-
System.delete_env("RABBITMQ_MNESIA_DIR")
93-
94-
assert :ok ==
95-
@command.validate(["some_node@localhost", "other_node@localhost"], context[:opts])
96-
end
97-
9841
test "banner", context do
9942
assert @command.banner(["a", "b"], context[:opts]) =~
100-
~r/Renaming cluster nodes: \n a -> b/
43+
~r/DEPRECATED. This command is a no-op./
10144
end
10245
end

deps/rabbitmq_cli/test/ctl/update_cluster_nodes_command_test.exs

Lines changed: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -29,61 +29,15 @@ defmodule UpdateClusterNodesCommandTest do
2929
}}
3030
end
3131

32-
test "validate: providing too few arguments fails validation", context do
33-
assert @command.validate([], context[:opts]) ==
34-
{:validation_failure, :not_enough_args}
35-
end
36-
37-
test "validate: providing too many arguments fails validation", context do
38-
assert @command.validate(["a", "b", "c"], context[:opts]) ==
39-
{:validation_failure, :too_many_args}
40-
end
41-
42-
test "run: specifying self as seed node fails validation", context do
43-
stop_rabbitmq_app()
44-
32+
test "run: no op", context do
4533
assert match?(
46-
{:error, :cannot_cluster_node_with_itself},
34+
:ok,
4735
@command.run([context[:opts][:node]], context[:opts])
4836
)
49-
50-
start_rabbitmq_app()
51-
end
52-
53-
test "run: request to an unreachable node returns a badrpc", context do
54-
opts = %{
55-
node: :jake@thedog,
56-
timeout: 200
57-
}
58-
59-
assert match?(
60-
{:badrpc, :nodedown},
61-
@command.run([context[:opts][:node]], opts)
62-
)
63-
end
64-
65-
test "run: specifying an unreachable node as seed returns a badrpc", context do
66-
stop_rabbitmq_app()
67-
68-
assert match?(
69-
{:badrpc_multi, _, [_]},
70-
@command.run([:jake@thedog], context[:opts])
71-
)
72-
73-
start_rabbitmq_app()
7437
end
7538

7639
test "banner", context do
7740
assert @command.banner(["a"], context[:opts]) =~
78-
~r/Will seed #{get_rabbit_hostname()} from a on next start/
79-
end
80-
81-
test "output mnesia is running error", context do
82-
exit_code = RabbitMQ.CLI.Core.ExitCodes.exit_software()
83-
84-
assert match?(
85-
{:error, ^exit_code, "Mnesia is still running on node " <> _},
86-
@command.output({:error, :mnesia_unexpectedly_running}, context[:opts])
87-
)
41+
~r/DEPRECATED. This command is a no-op./
8842
end
8943
end

0 commit comments

Comments
 (0)