Skip to content

Commit 950c4ef

Browse files
committed
Use rabbit:data_dir/0 instead of rabbit_mnesia:dir/0 where it makes sense
Some testcases are interested in RabbitMQ data directory, not Mnesia directory per se. In this case, call `rabbit:data_dir/0` instead.
1 parent 3f0d187 commit 950c4ef

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

deps/rabbit/test/per_vhost_msg_store_SUITE.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ folder_size(Dir) ->
193193
fun(F,Acc) -> filelib:file_size(F) + Acc end, 0).
194194

195195
get_global_folder_size(Config) ->
196-
BaseDir = rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_mnesia, dir, []),
196+
BaseDir = rabbit_ct_broker_helpers:rpc(Config, 0, rabbit, data_dir, []),
197197
folder_size(BaseDir).
198198

199199
vhost_dir(Vhost, Config) ->

deps/rabbitmq_cli/test/ctl/force_boot_command_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ defmodule ForceBootCommandTest do
4040
stop_rabbitmq_app()
4141
on_exit(fn -> start_rabbitmq_app() end)
4242
assert @command.run([], context[:opts]) == :ok
43-
data_dir = :rpc.call(get_rabbit_hostname(), :rabbit_mnesia, :dir, [])
43+
data_dir = :rpc.call(get_rabbit_hostname(), :rabbit, :data_dir, [])
4444

4545
path = Path.join(data_dir, "force_load")
4646
assert File.exists?(path)

deps/rabbitmq_cli/test/ctl/forget_cluster_node_command_test.exs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ defmodule ForgetClusterNodeCommandTest do
2020
:rabbit_misc.rpc_call(node, :application, :get_env, [:rabbit, :plugins_dir])
2121

2222
rabbitmq_home = :rabbit_misc.rpc_call(node, :code, :lib_dir, [:rabbit])
23-
data_dir = :rabbit_misc.rpc_call(node, :rabbit_mnesia, :dir, [])
23+
data_dir = :rabbit_misc.rpc_call(node, :rabbit, :data_dir, [])
2424

2525
feature_flags_file =
2626
:rabbit_misc.rpc_call(node, :rabbit_feature_flags, :enabled_feature_flags_list_file, [])
@@ -63,34 +63,34 @@ defmodule ForgetClusterNodeCommandTest do
6363
)
6464
end
6565

66-
test "validate_execution_environment: offline forget without mnesia dir fails", context do
66+
test "validate_execution_environment: offline forget without data dir fails", context do
6767
offline_opts =
6868
Map.merge(
6969
context[:opts],
7070
%{offline: true, node: :non_exist@localhost}
7171
)
7272

73-
opts_without_mnesia = Map.delete(offline_opts, :data_dir)
74-
Application.put_env(:mnesia, :dir, "/tmp")
75-
on_exit(fn -> Application.delete_env(:mnesia, :dir) end)
73+
opts_without_data_dir = Map.delete(offline_opts, :data_dir)
74+
Application.put_env(:rabbit, :data_dir, "/tmp")
75+
on_exit(fn -> Application.delete_env(:rabbit, :data_dir) end)
7676

7777
assert match?(
7878
:ok,
7979
@command.validate_execution_environment(
8080
["other_node@localhost"],
81-
opts_without_mnesia
81+
opts_without_data_dir
8282
)
8383
)
8484

85-
Application.delete_env(:mnesia, :dir)
85+
Application.delete_env(:rabbit, :data_dir)
8686
System.put_env("RABBITMQ_MNESIA_DIR", "/tmp")
8787
on_exit(fn -> System.delete_env("RABBITMQ_MNESIA_DIR") end)
8888

8989
assert match?(
9090
:ok,
9191
@command.validate_execution_environment(
9292
["other_node@localhost"],
93-
opts_without_mnesia
93+
opts_without_data_dir
9494
)
9595
)
9696

@@ -102,15 +102,15 @@ defmodule ForgetClusterNodeCommandTest do
102102
)
103103
end
104104

105-
test "validate_execution_environment: online mode does not fail is mnesia is not loaded",
105+
test "validate_execution_environment: online mode does not fail if database is not loaded",
106106
context do
107-
opts_without_mnesia = Map.delete(context[:opts], :data_dir)
107+
opts_without_data_dir = Map.delete(context[:opts], :data_dir)
108108

109109
assert match?(
110110
:ok,
111111
@command.validate_execution_environment(
112112
["other_node@localhost"],
113-
opts_without_mnesia
113+
opts_without_data_dir
114114
)
115115
)
116116
end

deps/rabbitmq_cli/test/ctl/rename_cluster_node_command_test.exs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ defmodule RenameClusterNodeCommandTest do
2020
:rabbit_misc.rpc_call(node, :application, :get_env, [:rabbit, :plugins_dir])
2121

2222
rabbitmq_home = :rabbit_misc.rpc_call(node, :code, :lib_dir, [:rabbit])
23-
data_dir = :rabbit_misc.rpc_call(node, :rabbit_mnesia, :dir, [])
23+
data_dir = :rabbit_misc.rpc_call(node, :rabbit, :data_dir, [])
2424

2525
on_exit([], fn ->
2626
start_rabbitmq_app()
@@ -67,26 +67,26 @@ defmodule RenameClusterNodeCommandTest do
6767
)
6868
end
6969

70-
test "validate_execution_environment: not providing node mnesia dir fails validation",
70+
test "validate_execution_environment: not providing node data dir fails validation",
7171
context do
72-
opts_without_mnesia = Map.delete(context[:opts], :data_dir)
73-
Application.put_env(:mnesia, :dir, "/tmp")
74-
on_exit(fn -> Application.delete_env(:mnesia, :dir) end)
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)
7575

7676
assert :ok ==
7777
@command.validate(
7878
["some_node@localhost", "other_node@localhost"],
79-
opts_without_mnesia
79+
opts_without_data_dir
8080
)
8181

82-
Application.delete_env(:mnesia, :dir)
82+
Application.delete_env(:rabbit, :data_dir)
8383
System.put_env("RABBITMQ_MNESIA_DIR", "/tmp")
8484
on_exit(fn -> System.delete_env("RABBITMQ_MNESIA_DIR") end)
8585

8686
assert :ok ==
8787
@command.validate(
8888
["some_node@localhost", "other_node@localhost"],
89-
opts_without_mnesia
89+
opts_without_data_dir
9090
)
9191

9292
System.delete_env("RABBITMQ_MNESIA_DIR")

0 commit comments

Comments
 (0)