./ct_report/coverage/mongoose_internal_databases.COVER.html

1 -module(mongoose_internal_databases).
2 -export([init/0]).
3
4 init() ->
5 93 case mongoose_config:lookup_opt([internal_databases, mnesia]) of
6 {ok, _} ->
7 93 init_mnesia(),
8 93 mongoose_node_num_mnesia:init();
9 {error, _} ->
10 %% Ensure mnesia is stopped when applying the test presets from the big tests.
11 %% So, we accidentually do not test with mnesia enabled, when starting the
12 %% test cases from the clean test build.
13 %% TODO Stopping here would break a lot of tests, stop here once tests are fixed.
14 % mnesia:stop(),
15
:-(
ok
16 end.
17
18 init_mnesia() ->
19 %% Mnesia should not be running at this point, unless it is started by tests.
20 %% Ensure Mnesia is stopped
21 93 mnesia:stop(),
22 93 case mnesia:system_info(extra_db_nodes) of
23 [] ->
24 93 mnesia:create_schema([node()]);
25 _ ->
26
:-(
ok
27 end,
28 93 application:start(mnesia, permanent),
29 93 mnesia:wait_for_tables(mnesia:system_info(local_tables), infinity).
Line Hits Source