Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ defmodule ChangeClusterNodeTypeCommandTest do
case :rabbit_misc.rpc_call(node, :rabbit_khepri, :is_enabled, []) do
true ->
assert match?(
:ok,
{:error, _},
@command.run(["ram"], context[:opts])
)

Expand Down
23 changes: 15 additions & 8 deletions deps/rabbitmq_cli/test/ctl/force_boot_command_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,21 @@ defmodule ForceBootCommandTest do
end

test "run: sets a force boot marker file on target node", context do
stop_rabbitmq_app()
on_exit(fn -> start_rabbitmq_app() end)
assert @command.run([], context[:opts]) == :ok
data_dir = :rpc.call(get_rabbit_hostname(), :rabbit, :data_dir, [])

path = Path.join(data_dir, "force_load")
assert File.exists?(path)
File.rm(path)
node = get_rabbit_hostname()
case :rabbit_misc.rpc_call(node, :rabbit_khepri, :is_enabled, []) do
true ->
:ok

false ->
stop_rabbitmq_app()
on_exit(fn -> start_rabbitmq_app() end)
assert @command.run([], context[:opts]) == :ok
data_dir = :rpc.call(node, :rabbit, :data_dir, [])

path = Path.join(data_dir, "force_load")
assert File.exists?(path)
File.rm(path)
end
end

test "run: if RABBITMQ_MNESIA_DIR is defined, creates a force boot marker file" do
Expand Down
10 changes: 9 additions & 1 deletion deps/rabbitmq_cli/test/ctl/force_reset_command_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,15 @@ defmodule ForceResetCommandTest do
test "run: reset request to an active node with a running rabbit app fails", context do
add_vhost("some_vhost")
assert vhost_exists?("some_vhost")
assert match?({:error, :mnesia_unexpectedly_running}, @command.run([], context[:opts]))
node = get_rabbit_hostname()
ret = @command.run([], context[:opts])
case :rabbit_misc.rpc_call(node, :rabbit_khepri, :is_enabled, []) do
true ->
assert match?({:error, :rabbitmq_unexpectedly_running}, ret)

false ->
assert match?({:error, :mnesia_unexpectedly_running}, ret)
end
assert vhost_exists?("some_vhost")
end

Expand Down
10 changes: 9 additions & 1 deletion deps/rabbitmq_cli/test/ctl/reset_command_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,15 @@ defmodule ResetCommandTest do
test "run: reset request to an active node with a running rabbit app fails", context do
add_vhost("some_vhost")
assert vhost_exists?("some_vhost")
assert match?({:error, :mnesia_unexpectedly_running}, @command.run([], context[:opts]))
node = get_rabbit_hostname()
ret = @command.run([], context[:opts])
case :rabbit_misc.rpc_call(node, :rabbit_khepri, :is_enabled, []) do
true ->
assert match?({:error, :rabbitmq_unexpectedly_running}, ret)

false ->
assert match?({:error, :mnesia_unexpectedly_running}, ret)
end
assert vhost_exists?("some_vhost")
end

Expand Down
19 changes: 13 additions & 6 deletions deps/rabbitmq_cli/test/diagnostics/schema_info_command_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,19 @@ defmodule SchemaInfoCommandTest do
end

test "run: can filter info keys", context do
wanted_keys = ~w(name access_mode)

assert match?(
[[name: _, access_mode: _] | _],
run_command_to_list(@command, [wanted_keys, context[:opts]])
)
node = context[:opts][:node]
case :rabbit_misc.rpc_call(node, :rabbit_khepri, :is_enabled, []) do
true ->
:ok

false ->
wanted_keys = ~w(name access_mode)

assert match?(
[[name: _, access_mode: _] | _],
run_command_to_list(@command, [wanted_keys, context[:opts]])
)
end
end

test "banner" do
Expand Down