mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-20 17:27:00 +01:00
Add tests for offline use_mam_for_storage
This commit is contained in:
parent
830a2f209a
commit
b716b835c4
@ -44,7 +44,7 @@
|
||||
%% Deprecated functions
|
||||
-export([get_opt/3, get_opt/4, get_module_opt/4, get_module_opt/5,
|
||||
get_opt_host/3, get_opt_hosts/3, db_type/2, db_type/3,
|
||||
ram_db_type/2, ram_db_type/3]).
|
||||
ram_db_type/2, ram_db_type/3, update_module_opts/3]).
|
||||
-deprecated([{get_opt, 3},
|
||||
{get_opt, 4},
|
||||
{get_opt_host, 3},
|
||||
@ -305,6 +305,19 @@ store_options(Host, Module, Opts, Order) ->
|
||||
#ejabberd_module{module_host = {Module, Host},
|
||||
opts = Opts, order = Order}).
|
||||
|
||||
-spec update_module_opts(binary(), module(), opts()) -> ok | {ok, pid()} | error.
|
||||
update_module_opts(Host, Module, NewValues) ->
|
||||
case ets:lookup(ejabberd_modules, {Module, Host}) of
|
||||
#ejabberd_module{opts = Opts, order = Order} ->
|
||||
NewOpts = lists:foldl(
|
||||
fun({K, _} = KV, Acc) ->
|
||||
lists:keystore(K, 1, Acc, KV)
|
||||
end, Opts, NewValues),
|
||||
reload_module(Host, Module, NewOpts, Opts, Order);
|
||||
_ ->
|
||||
error
|
||||
end.
|
||||
|
||||
maybe_halt_ejabberd() ->
|
||||
case is_app_running(ejabberd) of
|
||||
false ->
|
||||
|
@ -144,7 +144,8 @@ unsupported_iq(Config) ->
|
||||
master_slave_cases() ->
|
||||
{offline_master_slave, [sequence],
|
||||
[master_slave_test(flex),
|
||||
master_slave_test(send_all)]}.
|
||||
master_slave_test(send_all),
|
||||
master_slave_test(from_mam)]}.
|
||||
|
||||
flex_master(Config) ->
|
||||
send_messages(Config, 5),
|
||||
@ -174,6 +175,17 @@ flex_slave(Config) ->
|
||||
0 = get_number(Config),
|
||||
clean(disconnect(Config)).
|
||||
|
||||
offline_from_mam_master(Config) ->
|
||||
Server = ?config(server, Config),
|
||||
gen_mod:update_module_opts(Server, mod_offline, [{use_mam_for_storage, true}]),
|
||||
send_all_master(Config),
|
||||
gen_mod:update_module_opts(Server, mod_offline, [{use_mam_for_storage, false}]),
|
||||
wait_for_slave(Config).
|
||||
|
||||
offline_from_mam_slave(Config) ->
|
||||
send_all_slave(Config),
|
||||
wait_for_master(Config).
|
||||
|
||||
send_all_master(Config) ->
|
||||
wait_for_slave(Config),
|
||||
Peer = ?config(peer, Config),
|
||||
@ -298,7 +310,7 @@ get_nodes(Config) ->
|
||||
MyBareJID = jid:remove_resource(MyJID),
|
||||
Peer = ?config(peer, Config),
|
||||
Peer_s = jid:encode(Peer),
|
||||
ct:comment("Getting headers"),
|
||||
ct:comment("Getting headers"),
|
||||
#iq{type = result,
|
||||
sub_els = [#disco_items{
|
||||
node = ?NS_FLEX_OFFLINE,
|
||||
|
Loading…
Reference in New Issue
Block a user