Skip to content

Commit

Permalink
Add test for mongooseimctl mnesia info
Browse files Browse the repository at this point in the history
  • Loading branch information
arcusfelis committed Mar 7, 2022
1 parent 1b132c4 commit 7a91d32
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
16 changes: 15 additions & 1 deletion big_tests/tests/mongooseimctl_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ basic() ->
dump_table,
get_loglevel,
remove_old_messages_test,
remove_expired_messages_test].
remove_expired_messages_test,
kiss_tables_are_in_mnesia_info].

accounts() -> [change_password, check_password_hash, check_password,
check_account, ban_account, num_active_users, delete_old_users,
Expand Down Expand Up @@ -281,6 +282,13 @@ end_per_group(_GroupName, Config) ->
get_registered_users() ->
rpc(mim(), ejabberd_auth, get_vh_registered_users, [domain()]).

init_per_testcase(CaseName = kiss_tables_are_in_mnesia_info, Config) ->
case rpc(mim(), ejabberd_sm, sm_backend, []) of
ejabberd_sm_kiss ->
escalus:init_per_testcase(CaseName, Config);
_ ->
{skip, "Only for kiss preset"}
end;
init_per_testcase(CaseName, Config)
when CaseName == delete_old_users_vhost
orelse CaseName == stats_global
Expand Down Expand Up @@ -1269,6 +1277,12 @@ remove_expired_messages_test(Config) ->
2 = length(SecondList)
end).

kiss_tables_are_in_mnesia_info(Config) ->
{Out, 0} = mongooseimctl("mnesia", ["info"], Config),
Lines = binary:split(iolist_to_binary(Out), <<"\n">>, [global]),
[_Line] = [L || <<"table=kiss_session", _/binary>> = L <- Lines],
ok.

%%-----------------------------------------------------------------
%% Helpers
%%-----------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion rebar.lock
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
0},
{<<"kiss">>,
{git,"https://github.com/arcusfelis/kiss.git",
{ref,"56975c44de2c9515c99c620c6d23972170573020"}},
{ref,"4e7e23fcc0ffe58cf018a0f97437739133f859ed"}},
0},
{<<"lager">>,{pkg,<<"lager">>,<<"3.9.2">>},0},
{<<"lasse">>,{pkg,<<"lasse">>,<<"1.2.0">>},0},
Expand Down
2 changes: 1 addition & 1 deletion src/ejabberd_sm.erl
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
}.
-type info() :: #{info_key() => any()}.

-type backend() :: ejabberd_sm_mnesia | ejabberd_sm_redis.
-type backend() :: ejabberd_sm_mnesia | ejabberd_sm_redis | ejabberd_sm_kiss.
-type close_reason() :: resumed | normal | replaced.
-type info_key() :: atom().

Expand Down

0 comments on commit 7a91d32

Please sign in to comment.