Test: Fixes to handle re-running test after update_sql

Enable some modules so ejabberd creates their SQL tables
and later those tables can be updated without errors by mod_admin_update_sql
when ci.yml calls "make test" to check update_sql.

However, mod_shared_roster should be stopped before running the actual tests,
as it introduces undesired IQ queries

On the other hand, a few SQL tables are global RAM, and cannot be created
in SQL just for a vhost that is not the first one defined.
This commit is contained in:
Badlop
2025-01-13 00:00:40 +01:00
parent 862cacabcb
commit 4a363b6e76
4 changed files with 42 additions and 1 deletions
+18 -1
View File
@@ -100,6 +100,7 @@ do_init_per_group(mysql, Config) ->
{selected, _, _} ->
mod_muc:shutdown_rooms(?MYSQL_VHOST),
update_sql(?MYSQL_VHOST, Config),
stop_temporary_modules(?MYSQL_VHOST),
set_opt(server, ?MYSQL_VHOST, Config);
Err ->
{skip, {mysql_not_available, Err}}
@@ -109,6 +110,7 @@ do_init_per_group(mssql, Config) ->
{selected, _, _} ->
mod_muc:shutdown_rooms(?MSSQL_VHOST),
update_sql(?MSSQL_VHOST, Config),
stop_temporary_modules(?MSSQL_VHOST),
set_opt(server, ?MSSQL_VHOST, Config);
Err ->
{skip, {mssql_not_available, Err}}
@@ -118,6 +120,7 @@ do_init_per_group(pgsql, Config) ->
{selected, _, _} ->
mod_muc:shutdown_rooms(?PGSQL_VHOST),
update_sql(?PGSQL_VHOST, Config),
stop_temporary_modules(?PGSQL_VHOST),
set_opt(server, ?PGSQL_VHOST, Config);
Err ->
{skip, {pgsql_not_available, Err}}
@@ -161,6 +164,10 @@ do_init_per_group(GroupName, Config) ->
_ -> NewConfig
end.
stop_temporary_modules(Host) ->
Modules = [mod_shared_roster],
[gen_mod:stop_module(Host, M) || M <- Modules].
end_per_group(mnesia, _Config) ->
ok;
end_per_group(redis, _Config) ->
@@ -1094,7 +1101,17 @@ clear_table_queries(Queries) ->
fun(Query, Acc) ->
case split(str:to_lower(Query)) of
[<<"create">>, <<"table">>, Table|_] ->
[<<"DELETE FROM ", Table/binary, ";">>|Acc];
GlobalRamTables = [<<"bosh">>,
<<"oauth_client">>,
<<"oauth_token">>,
<<"proxy65">>,
<<"route">>],
case lists:member(Table, GlobalRamTables) of
true ->
Acc;
false ->
[<<"DELETE FROM ", Table/binary, ";">>|Acc]
end;
_ ->
Acc
end
@@ -69,3 +69,11 @@ Welcome to this XMPP server."
mod_stats: []
mod_time: []
mod_version: []
mod_mix:
db_type: sql
mod_mix_pam:
db_type: sql
mod_mqtt:
db_type: sql
mod_shared_roster:
db_type: sql
@@ -70,3 +70,11 @@ Welcome to this XMPP server."
mod_stats: []
mod_time: []
mod_version: []
mod_mix:
db_type: sql
mod_mix_pam:
db_type: sql
mod_mqtt:
db_type: sql
mod_shared_roster:
db_type: sql
@@ -70,3 +70,11 @@ Welcome to this XMPP server."
mod_stats: []
mod_time: []
mod_version: []
mod_mix:
db_type: sql
mod_mix_pam:
db_type: sql
mod_mqtt:
db_type: sql
mod_shared_roster:
db_type: sql