Skip to content

Commit

Permalink
Add tests for schema merge when using external backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikaka27 committed Mar 4, 2025
1 parent 67634a9 commit 2afad1f
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions lib/mnesia/test/mnesia_external_backend_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
-export([
conversion_from_external_to_disc_copies_should_not_result_in_data_loss_after_node_restart/1,
backup_and_restore_should_work_with_external_backend/1,
schema_creation_should_work_when_external_tables_exist/1
schema_creation_should_work_when_external_tables_exist/1,
schema_merge_should_work_when_node_is_removed_from_the_cluster_and_later_rejoins/1
]).

-include("mnesia_test_lib.hrl").
Expand All @@ -37,7 +38,8 @@
all() -> [
conversion_from_external_to_disc_copies_should_not_result_in_data_loss_after_node_restart,
backup_and_restore_should_work_with_external_backend,
schema_creation_should_work_when_external_tables_exist
schema_creation_should_work_when_external_tables_exist,
schema_merge_should_work_when_node_is_removed_from_the_cluster_and_later_rejoins
].

groups() ->
Expand Down Expand Up @@ -166,6 +168,22 @@ schema_creation_should_work_when_external_tables_exist(Config) when is_list(Conf
Ext = proplists:get_value(default_properties, Config, ?BACKEND),
?match(ok, mnesia:create_schema([Node], Ext)).

schema_merge_should_work_when_node_is_removed_from_the_cluster_and_later_rejoins(Config) when is_list(Config) ->
[N1, N2] = All = ?acquire_nodes(2, Config),

?match({atomic,ok}, mnesia:create_table(table, [
{type, set},
{record_name, some_rec},
{attributes, record_info(fields, some_rec)},
{ext_ram_copies, [N1, N2]}
])),

?match([], mnesia_test_lib:kill_mnesia([N2])),
?match({atomic, ok}, mnesia:del_table_copy(schema, N2)),

?match([], mnesia_test_lib:start_mnesia([N2])),
?verify_mnesia(All, []).

load_backup(BUP) ->
?match(ok, mnesia:install_fallback(BUP)),
?match(stopped, mnesia:stop()),
Expand Down

0 comments on commit 2afad1f

Please sign in to comment.