From 297f7433cfdeeb9162142a462cb45ffe0b263a38 Mon Sep 17 00:00:00 2001 From: Badlop Date: Mon, 15 Apr 2024 10:42:46 +0200 Subject: [PATCH] Instead of clearing tables when starting a group, clear them when ending a group Because a group may be started but the tables are not yet created, as they are created automatically when update_sql_schema is enabled. This modifies commit e2b79ea --- test/ejabberd_SUITE.erl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/ejabberd_SUITE.erl b/test/ejabberd_SUITE.erl index d2394083ca6..c51fdfa0b86 100644 --- a/test/ejabberd_SUITE.erl +++ b/test/ejabberd_SUITE.erl @@ -99,7 +99,6 @@ do_init_per_group(mysql, Config) -> case catch ejabberd_sql:sql_query(?MYSQL_VHOST, [<<"select 1;">>]) of {selected, _, _} -> mod_muc:shutdown_rooms(?MYSQL_VHOST), - clear_sql_tables(mysql, Config), update_sql(?MYSQL_VHOST, Config), set_opt(server, ?MYSQL_VHOST, Config); Err -> @@ -109,7 +108,6 @@ do_init_per_group(mssql, Config) -> case catch ejabberd_sql:sql_query(?MSSQL_VHOST, [<<"select 1;">>]) of {selected, _, _} -> mod_muc:shutdown_rooms(?MSSQL_VHOST), - clear_sql_tables(mssql, Config), update_sql(?MSSQL_VHOST, Config), set_opt(server, ?MSSQL_VHOST, Config); Err -> @@ -119,7 +117,6 @@ do_init_per_group(pgsql, Config) -> case catch ejabberd_sql:sql_query(?PGSQL_VHOST, [<<"select 1;">>]) of {selected, _, _} -> mod_muc:shutdown_rooms(?PGSQL_VHOST), - clear_sql_tables(pgsql, Config), update_sql(?PGSQL_VHOST, Config), set_opt(server, ?PGSQL_VHOST, Config); Err -> @@ -168,11 +165,14 @@ end_per_group(mnesia, _Config) -> ok; end_per_group(redis, _Config) -> ok; -end_per_group(mysql, _Config) -> +end_per_group(mysql, Config) -> + clear_sql_tables(mysql, Config), ok; -end_per_group(mssql, _Config) -> +end_per_group(mssql, Config) -> + clear_sql_tables(mssql, Config), ok; -end_per_group(pgsql, _Config) -> +end_per_group(pgsql, Config) -> + clear_sql_tables(pgsql, Config), ok; end_per_group(sqlite, _Config) -> ok;