Skip to content

Commit cbc2bc0

Browse files
committed
rabbitmq_cli: Adapt force_reset_command_test.exs testsuites
[Why] `force_reset` is unsupported with Khepri.
1 parent c325a36 commit cbc2bc0

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

deps/rabbitmq_cli/test/ctl/force_reset_command_test.exs

+18-9
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,23 @@ defmodule ForceResetCommandTest do
3131
end
3232

3333
test "run: force reset request to an active node with a stopped rabbit app succeeds", context do
34-
add_vhost("some_vhost")
35-
# ensure the vhost really does exist
36-
assert vhost_exists?("some_vhost")
37-
stop_rabbitmq_app()
38-
assert :ok == @command.run([], context[:opts])
39-
start_rabbitmq_app()
40-
# check that the created vhost no longer exists
41-
assert match?([_], list_vhosts())
34+
node = get_rabbit_hostname()
35+
case :rabbit_misc.rpc_call(node, :rabbit_khepri, :is_enabled, []) do
36+
true ->
37+
stop_rabbitmq_app()
38+
assert {:error, ~c"Forced reset is unsupported with Khepri"} == @command.run([], context[:opts])
39+
start_rabbitmq_app()
40+
41+
false ->
42+
add_vhost("some_vhost")
43+
# ensure the vhost really does exist
44+
assert vhost_exists?("some_vhost")
45+
stop_rabbitmq_app()
46+
assert :ok == @command.run([], context[:opts])
47+
start_rabbitmq_app()
48+
# check that the created vhost no longer exists
49+
assert match?([_], list_vhosts())
50+
end
4251
end
4352

4453
test "run: reset request to an active node with a running rabbit app fails", context do
@@ -49,7 +58,7 @@ defmodule ForceResetCommandTest do
4958

5059
case :rabbit_misc.rpc_call(node, :rabbit_khepri, :is_enabled, []) do
5160
true ->
52-
assert match?({:error, :rabbitmq_unexpectedly_running}, ret)
61+
assert match?({:error, ~c"Forced reset is unsupported with Khepri"}, ret)
5362

5463
false ->
5564
assert match?({:error, :mnesia_unexpectedly_running}, ret)

0 commit comments

Comments
 (0)