Skip to content

Commit

Permalink
Mnesia migration: CT - for debug failed tests ONLY
Browse files Browse the repository at this point in the history
  • Loading branch information
vkatsuba committed Dec 24, 2020
1 parent edaddc0 commit 007c951
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 122 deletions.
30 changes: 15 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ env:
- PRESET=small_tests RUN_SMALL_TESTS=true SKIP_RELEASE=1 SKIP_BUILD_TESTS=1
- PRESET=internal_mnesia DB="mnesia minio" REL_CONFIG="with-all" TLS_DIST=true
- PRESET=odbc_mssql_mnesia DB=mssql REL_CONFIG="with-odbc"
- PRESET=mysql_redis DB=mysql REL_CONFIG="with-mysql with-redis with-amqp_client"
- PRESET=riak_mnesia DB=riak REL_CONFIG="with-riak"
- PRESET=ldap_mnesia DB=mnesia REL_CONFIG="with-none"
- PRESET=elasticsearch_and_cassandra_mnesia DB="elasticsearch cassandra"
REL_CONFIG="with-elasticsearch with-cassandra" TESTSPEC=mam.spec
ELASTICSEARCH_VERSION=5.6.9 CASSANDRA_VERSION=3.9
- PRESET=dialyzer_only SKIP_RELEASE=1 SKIP_BUILD_TESTS=1 SKIP_COV=1 SKIP_REPORT_UPLOAD=1
#- PRESET=mysql_redis DB=mysql REL_CONFIG="with-mysql with-redis with-amqp_client"
#- PRESET=riak_mnesia DB=riak REL_CONFIG="with-riak"
#- PRESET=ldap_mnesia DB=mnesia REL_CONFIG="with-none"
#- PRESET=elasticsearch_and_cassandra_mnesia DB="elasticsearch cassandra"
# REL_CONFIG="with-elasticsearch with-cassandra" TESTSPEC=mam.spec
# ELASTICSEARCH_VERSION=5.6.9 CASSANDRA_VERSION=3.9
#- PRESET=dialyzer_only SKIP_RELEASE=1 SKIP_BUILD_TESTS=1 SKIP_COV=1 SKIP_REPORT_UPLOAD=1
# In case you want to test with another ODBC driver, uncomment this
# - PRESET=odbc_pgsql_mnesia DB=pgsql REL_CONFIG=with-odbc

Expand All @@ -105,14 +105,14 @@ matrix:
include:
- otp_release: 22.3
env: PRESET=pgsql_mnesia DB=pgsql REL_CONFIG="with-pgsql" RUN_SMALL_TESTS=true
- language: generic
env: PRESET=pkg pkg_PLATFORM=centos_7
SKIP_COMPILE=1 SKIP_RELEASE=1 SKIP_BUILD_TESTS=1 ESL_ERLANG_PKG_VER=22.1.8-2
SKIP_COV=1 SKIP_REPORT_UPLOAD=1
- language: generic
env: PRESET=pkg pkg_PLATFORM=debian_stretch ESL_ERLANG_PKG_VER=22.1.8-1
SKIP_COMPILE=1 SKIP_RELEASE=1 SKIP_BUILD_TESTS=1
SKIP_COV=1 SKIP_REPORT_UPLOAD=1
#- language: generic
# env: PRESET=pkg pkg_PLATFORM=centos_7
# SKIP_COMPILE=1 SKIP_RELEASE=1 SKIP_BUILD_TESTS=1 ESL_ERLANG_PKG_VER=22.1.8-2
# SKIP_COV=1 SKIP_REPORT_UPLOAD=1
#- language: generic
# env: PRESET=pkg pkg_PLATFORM=debian_stretch ESL_ERLANG_PKG_VER=22.1.8-1
# SKIP_COMPILE=1 SKIP_RELEASE=1 SKIP_BUILD_TESTS=1
# SKIP_COV=1 SKIP_REPORT_UPLOAD=1

notifications:
webhooks:
Expand Down
143 changes: 72 additions & 71 deletions big_tests/default.spec
Original file line number Diff line number Diff line change
Expand Up @@ -11,79 +11,80 @@
%% do not remove below SUITE if testing mongoose
{suites, "tests", mongoose_sanity_checks_SUITE}.

{suites, "tests", acc_e2e_SUITE}.
{suites, "tests", accounts_SUITE}.
{suites, "tests", adhoc_SUITE}.
{suites, "tests", amp_big_SUITE}.
{suites, "tests", anonymous_SUITE}.
{suites, "tests", bosh_SUITE}.
{suites, "tests", carboncopy_SUITE}.
{suites, "tests", cluster_commands_SUITE}.
{suites, "tests", component_SUITE}.
{suites, "tests", conf_reload_SUITE}.
{suites, "tests", config_format_SUITE}.
{suites, "tests", connect_SUITE}.
{suites, "tests", disco_and_caps_SUITE}.
{suites, "tests", ejabberdctl_SUITE}.
{suites, "tests", extdisco_SUITE}.
{suites, "tests", gdpr_SUITE}.
{suites, "tests", inbox_SUITE}.
{suites, "tests", jingle_SUITE}.
{suites, "tests", last_SUITE}.
{suites, "tests", login_SUITE}.
{suites, "tests", mam_SUITE}.
{suites, "tests", metrics_api_SUITE}.
{suites, "tests", metrics_c2s_SUITE}.
{suites, "tests", metrics_register_SUITE}.
{suites, "tests", metrics_roster_SUITE}.
{suites, "tests", metrics_session_SUITE}.
{suites, "tests", mod_aws_sns_SUITE}.
{suites, "tests", mod_blocking_SUITE}.
{suites, "tests", mod_event_pusher_rabbit_SUITE}.
{suites, "tests", mod_event_pusher_http_SUITE}.
{suites, "tests", mod_global_distrib_SUITE}.
{suites, "tests", mod_http_upload_SUITE}.
{suites, "tests", mod_ping_SUITE}.
{suites, "tests", mod_time_SUITE}.
{suites, "tests", mod_version_SUITE}.
{suites, "tests", mongoose_cassandra_SUITE}.
{suites, "tests", mongoose_elasticsearch_SUITE}.
{suites, "tests", muc_SUITE}.
{suites, "tests", muc_http_api_SUITE}.
{suites, "tests", muc_light_SUITE}.
{suites, "tests", muc_light_http_api_SUITE}.
{suites, "tests", muc_light_legacy_SUITE}.
{suites, "tests", oauth_SUITE}.
{suites, "tests", offline_SUITE}.
{suites, "tests", pep_SUITE}.
{suites, "tests", persistent_cluster_id_SUITE}.
{suites, "tests", presence_SUITE}.
{suites, "tests", privacy_SUITE}.
{suites, "tests", private_SUITE}.
{suites, "tests", pubsub_SUITE}.
{suites, "tests", pubsub_s2s_SUITE}.
{suites, "tests", push_SUITE}.
{suites, "tests", push_http_SUITE}.
{suites, "tests", push_integration_SUITE}.
{suites, "tests", push_pubsub_SUITE}.
{suites, "tests", race_conditions_SUITE}.
{suites, "tests", rdbms_SUITE}.
{suites, "tests", rest_SUITE}.
{suites, "tests", rest_client_SUITE}.
{suites, "tests", s2s_SUITE}.
{suites, "tests", sasl_SUITE}.
{suites, "tests", sasl_external_SUITE}.
{suites, "tests", service_mongoose_system_metrics_SUITE}.
{suites, "tests", shared_roster_SUITE}.
{suites, "tests", sic_SUITE}.
{suites, "tests", sm_SUITE}.
{suites, "tests", users_api_SUITE}.
{suites, "tests", vcard_SUITE}.
{suites, "tests", vcard_simple_SUITE}.
{suites, "tests", websockets_SUITE}.
{suites, "tests", xep_0352_csi_SUITE}.
{suites, "tests", mnesia_migration_SUITE}.

%{suites, "tests", acc_e2e_SUITE}.
%{suites, "tests", accounts_SUITE}.
%{suites, "tests", adhoc_SUITE}.
%{suites, "tests", amp_big_SUITE}.
%{suites, "tests", anonymous_SUITE}.
%{suites, "tests", bosh_SUITE}.
%{suites, "tests", carboncopy_SUITE}.
%{suites, "tests", cluster_commands_SUITE}.
%{suites, "tests", component_SUITE}.
%{suites, "tests", conf_reload_SUITE}.
%{suites, "tests", config_format_SUITE}.
%{suites, "tests", connect_SUITE}.
%{suites, "tests", disco_and_caps_SUITE}.
%{suites, "tests", ejabberdctl_SUITE}.
%{suites, "tests", extdisco_SUITE}.
%{suites, "tests", gdpr_SUITE}.
%{suites, "tests", inbox_SUITE}.
%{suites, "tests", jingle_SUITE}.
%{suites, "tests", last_SUITE}.
%{suites, "tests", login_SUITE}.
%{suites, "tests", mam_SUITE}.
%{suites, "tests", metrics_api_SUITE}.
%{suites, "tests", metrics_c2s_SUITE}.
%{suites, "tests", metrics_register_SUITE}.
%{suites, "tests", metrics_roster_SUITE}.
%{suites, "tests", metrics_session_SUITE}.
%{suites, "tests", mod_aws_sns_SUITE}.
%{suites, "tests", mod_blocking_SUITE}.
%{suites, "tests", mod_event_pusher_rabbit_SUITE}.
%{suites, "tests", mod_event_pusher_http_SUITE}.
%{suites, "tests", mod_global_distrib_SUITE}.
%{suites, "tests", mod_http_upload_SUITE}.
%{suites, "tests", mod_ping_SUITE}.
%{suites, "tests", mod_time_SUITE}.
%{suites, "tests", mod_version_SUITE}.
%{suites, "tests", mongoose_cassandra_SUITE}.
%{suites, "tests", mongoose_elasticsearch_SUITE}.
%{suites, "tests", muc_SUITE}.
%{suites, "tests", muc_http_api_SUITE}.
%{suites, "tests", muc_light_SUITE}.
%{suites, "tests", muc_light_http_api_SUITE}.
%{suites, "tests", muc_light_legacy_SUITE}.
%{suites, "tests", oauth_SUITE}.
%{suites, "tests", offline_SUITE}.
%{suites, "tests", pep_SUITE}.
%{suites, "tests", persistent_cluster_id_SUITE}.
%{suites, "tests", presence_SUITE}.
%{suites, "tests", privacy_SUITE}.
%{suites, "tests", private_SUITE}.
%{suites, "tests", pubsub_SUITE}.
%{suites, "tests", pubsub_s2s_SUITE}.
%{suites, "tests", push_SUITE}.
%{suites, "tests", push_http_SUITE}.
%{suites, "tests", push_integration_SUITE}.
%{suites, "tests", push_pubsub_SUITE}.
%{suites, "tests", race_conditions_SUITE}.
%{suites, "tests", rdbms_SUITE}.
%{suites, "tests", rest_SUITE}.
%{suites, "tests", rest_client_SUITE}.
%{suites, "tests", s2s_SUITE}.
%{suites, "tests", sasl_SUITE}.
%{suites, "tests", sasl_external_SUITE}.
%{suites, "tests", service_mongoose_system_metrics_SUITE}.
%{suites, "tests", shared_roster_SUITE}.
%{suites, "tests", sm_SUITE}.
%{suites, "tests", sic_SUITE}.
%{suites, "tests", users_api_SUITE}.
%{suites, "tests", vcard_SUITE}.
%{suites, "tests", vcard_simple_SUITE}.
%{suites, "tests", websockets_SUITE}.
%{suites, "tests", xep_0352_csi_SUITE}.

{config, ["test.config"]}.
{logdir, "ct_report"}.

Expand Down
56 changes: 28 additions & 28 deletions big_tests/tests/mnesia_migration_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ end_per_testcase(CaseName, Config) ->
%%% ==================================================================

migrate_pubsub_nodes(_Config) ->
Nidx = create_migration_node(),
_ = create_migration_node(),
{ok, _} = ?RPC_MIGRATE(<<"pubsub_nodes">>),
SqlData = #{table => <<"pubsub_nodes">>, where => <<"name='", ?NODE_NAME/binary, "'">>},
case sql_to_rdbms(SqlData#{act => <<"SELECT">>, column => <<"nidx">>}) of
{selected, [{Nidx}]} ->
case sql_to_rdbms(SqlData#{act => <<"SELECT">>, column => <<"name">>}) of
{selected, [{?NODE_NAME}]} ->
{updated, 1} = sql_to_rdbms(SqlData#{act => <<"DELETE">>, column => <<"">>}),
_ = clear_tables(),
ct:comment("Migration of 'pubsub_nodes' is successful for Nidx: ~p", [Nidx]);
ct:comment("Migration of 'pubsub_nodes' is successful for 'name': ~p", [?NODE_NAME]);
Any ->
ct:fail("Unexpected result of 'pubsub_nodes' migration ~p~n", [Any])
end.
Expand All @@ -133,12 +133,12 @@ migrate_pubsub_subscriptions(_Config) ->
Nidx = create_migration_node(),
ok = mongoose_helper:successful_rpc(mod_pubsub_db_mnesia, transaction, [#{name => add_subscription, args => [Nidx, ?JID, 'subscribed', <<"0000-0000-0000000">>, []]}]),
{ok, _} = ?RPC_MIGRATE(<<"pubsub_subscriptions">>),
SqlData = #{table => <<"pubsub_subscriptions">>, where => <<"nidx=", (list_to_binary(integer_to_list(Nidx)))/binary>>},
case sql_to_rdbms(SqlData#{act => <<"SELECT">>, column => <<"nidx">>}) of
{selected, [{Nidx}]} ->
SqlData = #{table => <<"pubsub_subscriptions">>, where => <<"luser='", ?USERNAME/binary, "'">>},
case sql_to_rdbms(SqlData#{act => <<"SELECT">>, column => <<"luser">>}) of
{selected, [{?USERNAME}]} ->
{updated, 1} = sql_to_rdbms(SqlData#{act => <<"DELETE">>, column => <<"">>}),
_ = clear_tables(),
ct:comment("Migration of 'pubsub_subscriptions' is successful for Nidx: ~p", [Nidx]);
ct:comment("Migration of 'pubsub_subscriptions' is successful for 'luser': ~p", [?USERNAME]);
Any ->
ct:fail("Unexpected result of 'pubsub_subscriptions' migration ~p~n", [Any])
end.
Expand All @@ -148,14 +148,14 @@ migrate_pubsub_subscriptions(_Config) ->
%%% ==================================================================

migrate_pubsub_affiliations(_Config) ->
Nidx = create_migration_node(),
_ = create_migration_node(),
{ok, _} = ?RPC_MIGRATE(<<"pubsub_affiliations">>),
SqlData = #{table => <<"pubsub_affiliations">>, where => <<"nidx=", (list_to_binary(integer_to_list(Nidx)))/binary>>},
case sql_to_rdbms(SqlData#{act => <<"SELECT">>, column => <<"nidx">>}) of
{selected, [{Nidx}]} ->
SqlData = #{table => <<"pubsub_affiliations">>, where => <<"luser='", ?USERNAME/binary, "'">>},
case sql_to_rdbms(SqlData#{act => <<"SELECT">>, column => <<"luser">>}) of
{selected, [{?USERNAME}]} ->
{updated, 1} = sql_to_rdbms(SqlData#{act => <<"DELETE">>, column => <<"">>}),
_ = clear_tables(),
ct:comment("Migration of 'pubsub_affiliations' is successful for Nidx: ~p", [Nidx]);
ct:comment("Migration of 'pubsub_affiliations' is successful for 'pubsub_affiliations': ~p", [?USERNAME]);
Any ->
ct:fail("Unexpected result of 'pubsub_affiliations' migration ~p~n", [Any])
end.
Expand All @@ -168,12 +168,12 @@ migrate_pubsub_items(_Config) ->
Nidx = create_migration_node(),
ok = mongoose_helper:successful_rpc(mod_pubsub_db_mnesia, transaction, [#{name => add_item, args => [Nidx, ?JID, ?BASE_ITEM(Nidx)]}]),
{ok, _} = ?RPC_MIGRATE(<<"pubsub_items">>),
SqlData = #{table => <<"pubsub_items">>, where => <<"nidx=", (list_to_binary(integer_to_list(Nidx)))/binary>>},
case sql_to_rdbms(SqlData#{act => <<"SELECT">>, column => <<"nidx">>}) of
{selected, [{Nidx}]} ->
SqlData = #{table => <<"pubsub_items">>, where => <<"created_luser='", ?USERNAME/binary, "'">>},
case sql_to_rdbms(SqlData#{act => <<"SELECT">>, column => <<"created_luser">>}) of
{selected, [{?USERNAME}]} ->
{updated, 1} = sql_to_rdbms(SqlData#{act => <<"DELETE">>, column => <<"">>}),
_ = clear_tables(),
ct:comment("Migration of 'pubsub_items' is successful for Nidx: ~p", [Nidx]);
ct:comment("Migration of 'pubsub_items' is successful for 'created_luser': ~p", [?USERNAME]);
Any ->
ct:fail("Unexpected result of 'pubsub_items' migration ~p~n", [Any])
end.
Expand Down Expand Up @@ -216,7 +216,7 @@ migrate_vcard_search(_Config) ->
%%% Test case for migrate vcard
%%% ==================================================================

migrate_vcard(Config) ->
migrate_vcard(_Config) ->
ok = set_vcard(),
{ok, _} = ?RPC_MIGRATE(<<"vcard">>),
SqlData = #{table => <<"vcard">>, where => <<"username='", ?USERNAME/binary, "'">>},
Expand All @@ -233,7 +233,7 @@ migrate_vcard(Config) ->
%%% Test case for migrate event_pusher_push_subscription
%%% ==================================================================

migrate_event_pusher_push_subscription(Config) ->
migrate_event_pusher_push_subscription(_Config) ->
PubsubNode = <<"migration_pub_sub_node">>,
ok = mongoose_helper:successful_rpc(mod_event_pusher_push_mnesia, enable, [?JID, ?JID, PubsubNode, [{<<"name">>, <<"value">>}]]),
{ok, _} = ?RPC_MIGRATE(<<"event_pusher_push_subscription">>),
Expand All @@ -251,63 +251,63 @@ migrate_event_pusher_push_subscription(Config) ->
%%% Test case for migrate rosterusers @TODO
%%% ==================================================================

migrate_rosterusers(Config) ->
migrate_rosterusers(_Config) ->
?RPC_MIGRATE(<<"rosterusers">>),
ct:comment("TEST CASE ~p", [?FUNCTION_NAME]).

%%% ==================================================================
%%% Test case for migrate roster_version @TODO
%%% ==================================================================

migrate_roster_version(Config) ->
migrate_roster_version(_Config) ->
?RPC_MIGRATE(<<"roster_version">>),
ct:comment("TEST CASE ~p", [?FUNCTION_NAME]).

%%% ==================================================================
%%% Test case for migrate rostergroups @TODO
%%% ==================================================================

migrate_rostergroups(Config) ->
migrate_rostergroups(_Config) ->
?RPC_MIGRATE(<<"rostergroups">>),
ct:comment("TEST CASE ~p", [?FUNCTION_NAME]).

%%% ==================================================================
%%% Test case for migrate last @TODO
%%% ==================================================================

migrate_last(Config) ->
migrate_last(_Config) ->
?RPC_MIGRATE(<<"last">>),
ct:comment("TEST CASE ~p", [?FUNCTION_NAME]).

%%% ==================================================================
%%% Test case for migrate private_storage @TODO
%%% ==================================================================

migrate_private_storage(Config) ->
migrate_private_storage(_Config) ->
?RPC_MIGRATE(<<"private_storage">>),
ct:comment("TEST CASE ~p", [?FUNCTION_NAME]).

%%% ==================================================================
%%% Test case for migrate offline_message @TODO
%%% ==================================================================

migrate_offline_message(Config) ->
migrate_offline_message(_Config) ->
?RPC_MIGRATE(<<"offline_message">>),
ct:comment("TEST CASE ~p", [?FUNCTION_NAME]).

%%% ==================================================================
%%% Test case for migrate muc_light_rooms @TODO
%%% ==================================================================

migrate_muc_light_rooms(Config) ->
migrate_muc_light_rooms(_Config) ->
?RPC_MIGRATE(<<"muc_light_rooms">>),
ct:comment("TEST CASE ~p", [?FUNCTION_NAME]).

%%% ==================================================================
%%% Test case for migrate all @TODO
%%% ==================================================================

migrate_all(Config) ->
migrate_all(_Config) ->
?RPC_MIGRATE(<<"all">>),
ct:comment("TEST CASE ~p", [?FUNCTION_NAME]).

Expand All @@ -331,7 +331,7 @@ slow_rpc(M, F, A) ->

sql_to_rdbms(#{act := Act, column := Column, table := Table, where := Where}) ->
SelectQuery = <<Act/binary, " ", Column/binary, " FROM ", Table/binary, " WHERE ", Where/binary>>,
SelectResult = sql_query(SelectQuery).
sql_query(SelectQuery).

clear_tables() ->
Tables = [pubsub_state, pubsub_item, pubsub_node,
Expand Down
Loading

0 comments on commit 007c951

Please sign in to comment.