Skip to content

Commit 66a02b4

Browse files
vkatsubavkatsuba
authored andcommitted
Mnesia migration: CT
1 parent 060adf4 commit 66a02b4

File tree

4 files changed

+611
-382
lines changed

4 files changed

+611
-382
lines changed

big_tests/default.spec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
{suites, "tests", vcard_simple_SUITE}.
8181
{suites, "tests", websockets_SUITE}.
8282
{suites, "tests", xep_0352_csi_SUITE}.
83+
{suites, "tests", mnesia_migration_SUITE}.
8384

8485
{config, ["test.config"]}.
8586
{logdir, "ct_report"}.
Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
-module(mnesia_migration_SUITE).
2+
3+
-compile(export_all).
4+
5+
%%% ==================================================================
6+
%%% Includes
7+
%%% ==================================================================
8+
9+
-include_lib("escalus/include/escalus.hrl").
10+
-include_lib("exml/include/exml.hrl").
11+
-include_lib("common_test/include/ct.hrl").
12+
13+
%%% ==================================================================
14+
%%% Macro
15+
%%% ==================================================================
16+
17+
-define(RPC_MIGRATE(Act), mongoose_helper:successful_rpc(service_admin_extra_migration, migrate, [<<"mnesia">>, <<"rdbms">>, Act])).
18+
19+
%%--------------------------------------------------------------------
20+
%% Suite configuration
21+
%%--------------------------------------------------------------------
22+
23+
all() ->
24+
case (not ct_helper:is_ct_running()) orelse mongoose_helper:is_rdbms_enabled(ct:get_config({hosts, mim, domain})) of
25+
true ->
26+
tests();
27+
false ->
28+
{skip, require_rdbms}
29+
end.
30+
31+
tests() ->
32+
[
33+
{group, migration}
34+
].
35+
36+
groups() ->
37+
G =
38+
[
39+
{migration, [sequence],
40+
[
41+
migrate_pubsub_nodes,
42+
migrate_pubsub_subscriptions,
43+
migrate_pubsub_affiliations,
44+
migrate_pubsub_items,
45+
migrate_users,
46+
migrate_vcard_search,
47+
migrate_vcard,
48+
migrate_event_pusher_push_subscription,
49+
migrate_rosterusers,
50+
migrate_roster_version,
51+
migrate_rostergroups,
52+
migrate_last,
53+
migrate_private_storage,
54+
migrate_offline_message,
55+
migrate_muc_light_rooms,
56+
migrate_all
57+
]
58+
}
59+
],
60+
ct_helper:repeat_all_until_all_ok(G).
61+
62+
suite() ->
63+
escalus:suite().
64+
65+
init_per_suite(Config) ->
66+
escalus:init_per_suite(Config).
67+
68+
end_per_suite(Config) ->
69+
escalus_fresh:clean(),
70+
escalus:end_per_suite(Config).
71+
72+
init_per_group(_GroupName, Config) ->
73+
Config.
74+
75+
end_per_group(_GroupName, Config) ->
76+
Config.
77+
78+
init_per_testcase(CaseName, Config) ->
79+
escalus:init_per_testcase(CaseName, Config).
80+
81+
end_per_testcase(CaseName, Config) ->
82+
escalus:end_per_testcase(CaseName, Config).
83+
84+
%%% ==================================================================
85+
%%% Test case for migrate pubsub_nodes @TODO
86+
%%% ==================================================================
87+
88+
migrate_pubsub_nodes(Config) ->
89+
R = ?RPC_MIGRATE(<<"pubsub_nodes">>),
90+
ct:comment("TEST CASE ~p", [{?FUNCTION_NAME, R}]).
91+
92+
%%% ==================================================================
93+
%%% Test case for migrate pubsub_subscriptions @TODO
94+
%%% ==================================================================
95+
96+
migrate_pubsub_subscriptions(Config) ->
97+
?RPC_MIGRATE(<<"pubsub_subscriptions">>),
98+
ct:comment("TEST CASE ~p", [?FUNCTION_NAME]).
99+
100+
%%% ==================================================================
101+
%%% Test case for migrate pubsub_affiliations @TODO
102+
%%% ==================================================================
103+
104+
migrate_pubsub_affiliations(Config) ->
105+
?RPC_MIGRATE(<<"pubsub_affiliations">>),
106+
ct:comment("TEST CASE ~p", [?FUNCTION_NAME]).
107+
108+
%%% ==================================================================
109+
%%% Test case for migrate pubsub_items @TODO
110+
%%% ==================================================================
111+
112+
migrate_pubsub_items(Config) ->
113+
?RPC_MIGRATE(<<"pubsub_items">>),
114+
ct:comment("TEST CASE ~p", [?FUNCTION_NAME]).
115+
116+
%%% ==================================================================
117+
%%% Test case for migrate users @TODO
118+
%%% ==================================================================
119+
120+
migrate_users(Config) ->
121+
?RPC_MIGRATE(<<"users">>),
122+
ct:comment("TEST CASE ~p", [?FUNCTION_NAME]).
123+
124+
%%% ==================================================================
125+
%%% Test case for migrate vcard_search @TODO
126+
%%% ==================================================================
127+
128+
migrate_vcard_search(Config) ->
129+
?RPC_MIGRATE(<<"vcard_search">>),
130+
ct:comment("TEST CASE ~p", [?FUNCTION_NAME]).
131+
132+
%%% ==================================================================
133+
%%% Test case for migrate vcard @TODO
134+
%%% ==================================================================
135+
136+
migrate_vcard(Config) ->
137+
?RPC_MIGRATE(<<"vcard">>),
138+
ct:comment("TEST CASE ~p", [?FUNCTION_NAME]).
139+
140+
%%% ==================================================================
141+
%%% Test case for migrate event_pusher_push_subscription @TODO
142+
%%% ==================================================================
143+
144+
migrate_event_pusher_push_subscription(Config) ->
145+
?RPC_MIGRATE(<<"event_pusher_push_subscription">>),
146+
ct:comment("TEST CASE ~p", [?FUNCTION_NAME]).
147+
148+
%%% ==================================================================
149+
%%% Test case for migrate rosterusers @TODO
150+
%%% ==================================================================
151+
152+
migrate_rosterusers(Config) ->
153+
?RPC_MIGRATE(<<"rosterusers">>),
154+
ct:comment("TEST CASE ~p", [?FUNCTION_NAME]).
155+
156+
%%% ==================================================================
157+
%%% Test case for migrate roster_version @TODO
158+
%%% ==================================================================
159+
160+
migrate_roster_version(Config) ->
161+
?RPC_MIGRATE(<<"roster_version">>),
162+
ct:comment("TEST CASE ~p", [?FUNCTION_NAME]).
163+
164+
%%% ==================================================================
165+
%%% Test case for migrate rostergroups @TODO
166+
%%% ==================================================================
167+
168+
migrate_rostergroups(Config) ->
169+
?RPC_MIGRATE(<<"rostergroups">>),
170+
ct:comment("TEST CASE ~p", [?FUNCTION_NAME]).
171+
172+
%%% ==================================================================
173+
%%% Test case for migrate last @TODO
174+
%%% ==================================================================
175+
176+
migrate_last(Config) ->
177+
?RPC_MIGRATE(<<"last">>),
178+
ct:comment("TEST CASE ~p", [?FUNCTION_NAME]).
179+
180+
%%% ==================================================================
181+
%%% Test case for migrate private_storage @TODO
182+
%%% ==================================================================
183+
184+
migrate_private_storage(Config) ->
185+
?RPC_MIGRATE(<<"private_storage">>),
186+
ct:comment("TEST CASE ~p", [?FUNCTION_NAME]).
187+
188+
%%% ==================================================================
189+
%%% Test case for migrate offline_message @TODO
190+
%%% ==================================================================
191+
192+
migrate_offline_message(Config) ->
193+
?RPC_MIGRATE(<<"offline_message">>),
194+
ct:comment("TEST CASE ~p", [?FUNCTION_NAME]).
195+
196+
%%% ==================================================================
197+
%%% Test case for migrate muc_light_rooms @TODO
198+
%%% ==================================================================
199+
200+
migrate_muc_light_rooms(Config) ->
201+
?RPC_MIGRATE(<<"muc_light_rooms">>),
202+
ct:comment("TEST CASE ~p", [?FUNCTION_NAME]).
203+
204+
%%% ==================================================================
205+
%%% Test case for migrate all @TODO
206+
%%% ==================================================================
207+
208+
migrate_all(Config) ->
209+
?RPC_MIGRATE(<<"all">>),
210+
ct:comment("TEST CASE ~p", [?FUNCTION_NAME]).

rel/files/mongooseim.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@
199199

200200
[services.service_admin_extra]
201201
submods = ["node", "accounts", "sessions", "vcard", "gdpr", "upload",
202-
"roster", "last", "private", "stanza", "stats"]
202+
"roster", "last", "private", "stanza", "stats", "migration"]
203203

204204
[services.service_mongoose_system_metrics]
205205
initial_report = 300_000

0 commit comments

Comments
 (0)