From f54e70231bfaa93ed205c22b146503e78f7b78ef Mon Sep 17 00:00:00 2001 From: Feco Boroczki Date: Thu, 26 Apr 2018 17:38:41 +0200 Subject: [PATCH 1/5] use updated edown --- rebar.config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rebar.config b/rebar.config index 9648cc5..1d2fef4 100644 --- a/rebar.config +++ b/rebar.config @@ -1,7 +1,7 @@ %% -*- erlang -*- {erl_opts, [debug_info]}. -{deps, [{edown, ".*", {git, "git://github.com/esl/edown.git", "HEAD"}} +{deps, [{edown, ".*", {git, "git://github.com/uwiger/edown.git", "HEAD"}} ]}. {edoc_opts, [{doclet, edown_doclet}, {top_level_readme, - {"./README.md", "http://github.com/esl/unsplit"}}]}. + {"./README.md", "http://github.com/uwiger/unsplit"}}]}. From c40b142bd9851a7a2be863bd35f9dc543a1e8fbd Mon Sep 17 00:00:00 2001 From: Feco Boroczki Date: Thu, 26 Apr 2018 17:52:54 +0200 Subject: [PATCH 2/5] create tests for update and insert new records (insert fails) --- test/unsplit_2nodes_SUITE.erl | 191 ++++++++++++++++++++++++++++++++++ test/unsplit_SUITE.erl | 156 --------------------------- 2 files changed, 191 insertions(+), 156 deletions(-) create mode 100644 test/unsplit_2nodes_SUITE.erl delete mode 100644 test/unsplit_SUITE.erl diff --git a/test/unsplit_2nodes_SUITE.erl b/test/unsplit_2nodes_SUITE.erl new file mode 100644 index 0000000..7469c78 --- /dev/null +++ b/test/unsplit_2nodes_SUITE.erl @@ -0,0 +1,191 @@ +-module(unsplit_2nodes_SUITE). + +-include_lib("eunit/include/eunit.hrl"). +-include_lib("common_test/include/ct.hrl"). + +-export([init_per_suite/1, end_per_suite/1]). +-export([all/0]). +-export([insert_new_records/1, change_existing_records/1]). +-export([write/1, read/1]). + +-define(ERL_FLAGS, "-kernel dist_auto_connect once"). +-define(TABLE, test1). +-define(NODES, ['mn1', 'mn2']). + +-record(?TABLE, {key, modified = erlang:timestamp(), value}). + +all() -> + [ + insert_new_records, + change_existing_records + ]. + + +init_per_suite(Conf) -> + Nodes = ct:get_config(nodes, ?NODES), + + StartNode = + fun(Node) -> + {ok, NodeName} = ct_slave:start(Node, [{erl_flags, make_erl_flags()}]), + NodeName + end, + + NodeNames = lists:map(StartNode, Nodes), + + init_nodes(NodeNames), + + [{nodes, NodeNames} | Conf]. + +end_per_suite(_Conf) -> + Nodes = ct:get_config(nodes, ?NODES), + terminate_nodes(Nodes), + StopNode = + fun(Node) -> + {ok, _NodeName} = ct_slave:stop(Node) + end, + lists:map(StopNode, Nodes), + ok. + +insert_new_records(Conf) -> + Nodes = [Node1, Node2 | _Rest] = ?config(nodes, Conf), + + Element1 = #?TABLE{key = 1, value = a}, + Element2 = #?TABLE{key = 2, value = a}, + Element3 = #?TABLE{key = 3, value = b}, + Element4 = #?TABLE{key = 4, value = b}, + Element5 = #?TABLE{key = 5, value = c}, + + 0 = table_size(Node1, ?TABLE), + 0 = table_size(Node2, ?TABLE), + + {atomic, ok} = write(Node1, [Element1, Element2]), + ct:sleep(100), + 2 = table_size(Node1, ?TABLE), + 2 = table_size(Node2, ?TABLE), + + disconnect(Node1, Node2), + + {atomic, ok} = write(Node1, [Element3, Element4]), + {atomic, ok} = write(Node2, [Element5]), + + 4 = table_size(Node1, ?TABLE), + 3 = table_size(Node2, ?TABLE), + + connect(Node2, Node1), + + 5 = table_size(Node1, ?TABLE), + 5 = table_size(Node2, ?TABLE), + + true = compare_table_size(Nodes, ?TABLE). + +change_existing_records(Conf) -> + [Node1, Node2 | _Rest] = ?config(nodes, Conf), + + K1 = 11, + Element1V1 = #?TABLE{key = K1, value = av1, modified = 1}, + Element1V2 = #?TABLE{key = K1, value = av2, modified = 2}, + + K2 = 21, + Element2V1 = #?TABLE{key = K2, value = bv1, modified = 1}, + Element2V2 = #?TABLE{key = K2, value = bv2, modified = 2}, + + {atomic, ok} = write(Node1, [Element1V1]), + {atomic, ok} = write(Node2, [Element2V1]), + ct:sleep(100), + + ckeck_element(Node1, K1, Element1V1), + ckeck_element(Node2, K1, Element1V1), + ckeck_element(Node1, K2, Element2V1), + ckeck_element(Node2, K2, Element2V1), + + disconnect(Node1, Node2), + + {atomic, ok} = write(Node1, [Element1V2]), + {atomic, ok} = write(Node2, [Element2V2]), + + ckeck_element(Node1, K1, Element1V2), + ckeck_element(Node2, K1, Element1V1), + ckeck_element(Node1, K2, Element2V1), + ckeck_element(Node2, K2, Element2V2), + + connect(Node1, Node2), + + ckeck_element(Node1, K1, Element1V2), + ckeck_element(Node2, K1, Element1V2), + ckeck_element(Node1, K2, Element2V2), + ckeck_element(Node2, K2, Element2V2), + + ok. + +ckeck_element(Node, Key, Element) -> + {atomic, [Element]} = read(Node, Key). + +compare_table_size([Node1, Node2 | _], Table) -> + table_size(Node1, Table) == table_size(Node2, Table). + +table_size(Node, Table) -> + ct_rpc:call(Node, mnesia, table_info, [Table, size]). + +terminate_nodes(Nodes) -> + Terminate = fun(Node) -> + ct_rpc:call(Node, application, stop, [unsplit]), + ct_rpc:call(Node, mnesia, stop, []), + ct_rpc:call(Node, application, stop, [sasl]) + end, + lists:foreach(Terminate, Nodes). + +init_nodes([FirstNode | _] = Nodes) -> + Init = + fun(Node) -> + {ok, [mnesia, unsplit]} = ct_rpc:call(Node, application, ensure_all_started, + [unsplit]), + {ok, _} = ct_rpc:call(Node, mnesia, change_config, + [extra_db_nodes, Nodes--[Node]]) + end, + CreateTable = + fun(Node) -> + Tables = [?TABLE, [ + {ram_copies, Nodes}, + {attributes, [key, modified, value]}, + {user_properties, [{unsplit_method, {unsplit_lib, last_modified, []}}]} + ]], + {atomic, ok} = ct_rpc:call(Node, mnesia, create_table, Tables) + end, + WaitForTables = + fun(Node) -> + ok = ct_rpc:call(Node, mnesia, wait_for_tables, [[?TABLE], 1000]) + end, + lists:foreach(Init, Nodes), + CreateTable(FirstNode), + lists:foreach(WaitForTables, Nodes). + +disconnect(Node1, Node2) -> + ct_rpc:call(Node1, erlang, disconnect_node, [Node2]). +connect(Node1, Node2) -> + ct_rpc:call(Node1, net_kernel, connect_node, [Node2]), + ct:sleep(500). + +write(Node, Records) -> + ct_rpc:call(Node, ?MODULE, write, [Records]). + +write(Records) -> + mnesia:transaction(fun() -> lists:foreach(fun mnesia:write/1, Records) end). + +read(Node, Key) -> + ct_rpc:call(Node, ?MODULE, read, [Key]). + +read(Key) -> + mnesia:transaction(fun() -> mnesia:read(?TABLE, Key) end). + +make_erl_flags() -> + ThisDir = filename:dirname(code:which(?MODULE)), + TestPath = filename:absname(ThisDir), + EbinPath = filename:absname(ThisDir ++ "/../ebin"), + lists:flatten([?ERL_FLAGS, get_path_flags(), + " -pa ", EbinPath, + " -pa ", TestPath]). + +get_path_flags() -> + [[[" -", atom_to_list(K), " ", D] || D <- V] + || {K, V} <- init:get_arguments(), + K == pa orelse K == pz]. diff --git a/test/unsplit_SUITE.erl b/test/unsplit_SUITE.erl deleted file mode 100644 index 43ff262..0000000 --- a/test/unsplit_SUITE.erl +++ /dev/null @@ -1,156 +0,0 @@ -%%% @doc -%%% Test suite for unsplit -%%% @copyright Nimbuzz B.V. -%%% @author Ahmed Omar --module(unsplit_SUITE). -%%% @end --include_lib("eunit/include/eunit.hrl"). -%%% Include files --include_lib("common_test/include/ct.hrl"). - -%%% External exports --compile(export_all). -%% -define(ERL_FLAGS, "-kernel dist_auto_connect once -pa ../../ -pa ../../../ebin/"). --define(ERL_FLAGS, "-kernel dist_auto_connect once"). --define(TABLE, test1). --define(NODES, ['mn1@localhost', 'mn2@localhost']). --define(DISCONNECT_TIME, 4000). --define(UNSPLIT_TIMEOUT, 5000). --record(?TABLE,{key,modified=erlang:now(),value}). -%%% Macros - -all() -> - [split1]. - - -init_per_suite(Conf) -> - Nodes = ct:get_config(nodes, ?NODES), - DisconnectTime = ct:get_config(disconnect_time, ?DISCONNECT_TIME), - UnsplitTimeout = ct:get_config(unsplit_timeout, ?UNSPLIT_TIMEOUT), - Host = get_host(), - ErlFlags = lists:flatten([?ERL_FLAGS, - get_path_flags(), - " -pa ", filename:absname( - filename:dirname(code:which(?MODULE)))]), - ct:print("ErlFlags = ~p~n", [ErlFlags]), - StartNode = fun(Node)-> - ct:print("starting node ~p, on host ~p ~n",[Node, Host]), - {ok, NodeName} = ct_slave:start(Host, Node, - [{erl_flags, ErlFlags}]), - NodeName - end, - - NodeNames = lists:map(StartNode, Nodes), - [{disconnect_time, DisconnectTime}, - {unsplit_timeout, UnsplitTimeout}, - {nodes, NodeNames}|Conf]. - -end_per_suite(_Conf) -> - Nodes = ct:get_config(nodes,?NODES), - Host = get_host(), - StopNode = fun(Node)-> - {ok, _NodeName} = ct_slave:stop(Host, Node) - end, - lists:map(StopNode, Nodes), - ok. - -init_per_testcase(Case, Conf) -> - ct:print("Test case ~p started", [Case]), - init_nodes(get_conf(nodes, Conf)), - Conf. - -end_per_testcase(Case, Conf) -> - ct:print("Test case ~p finished", [Case]), - terminate_nodes(get_conf(nodes, Conf)), - Conf. - -split1()-> - [{userdata, [{doc, "Tests split network of 2 nodes"}]}]. -split1(Conf)-> - DisconnectTime = get_conf(disconnect_time, Conf), - UnsplitTimeout = get_conf(unsplit_timeout, Conf), - Nodes = [M, S|_Rest] = get_conf(nodes, Conf), - ct:print("Initial table size~n"), - print_table_size(Nodes, ?TABLE), - ct:print("inserting records~n"), - {atomic, ok} = write(M, [#?TABLE{key=1, value=a}, #?TABLE{key=2, value=a}]), - print_table_size(Nodes, ?TABLE), - ct:print("disconnecting nodes~n"), - disconnect(M, S), - ct:print("inserting records on one node, while the other one is disconnected~n"), - {atomic, ok} = write(M, [#?TABLE{key=3, value=b}, #?TABLE{key=4, value=b}]), - print_table_size(Nodes, ?TABLE), - timer:sleep(DisconnectTime), - ct:print("reconnecting nodes~n"), - connect(S, M), - timer:sleep(UnsplitTimeout), - print_table_size(Nodes, ?TABLE), - true = compare_table_size(Nodes, ?TABLE). - - -compare_table_size([Node1, Node2|_], Table)-> - table_size(Node1, Table) == table_size(Node2, Table). - -table_size(Node, Table)-> - rpc:call(Node, mnesia, table_info,[Table, size]). - -print_table_size([M,S|_], Table)-> - ct:print("master size = ~p~n",[table_size(M, Table)]), - ct:print("slave size = ~p~n",[table_size(S, Table)]). - -get_conf(Key, Conf)-> - proplists:get_value(Key, Conf). - - -terminate_nodes(Nodes)-> - Terminate = fun(Node)-> - rpc:call(Node, application, stop, [unsplit]), - rpc:call(Node, mnesia, stop,[]), - rpc:call(Node, application, stop, [sasl]) - end, - lists:foreach(Terminate, Nodes). - - -init_nodes(Nodes)-> - Init = fun(Node)-> - rpc:call(Node, mnesia, delete_schema,[Node]), - rpc:call(Node, application, start, [sasl]), - rpc:call(Node, mnesia, start,[]), - rpc:call(Node, application, start, [unsplit]), - rpc:call(Node, mnesia, create_schema, [Nodes]), - rpc:call(Node, mnesia, change_config, [extra_db_nodes, Nodes--[Node]]), - rpc:call(Node, mnesia, delete_table, [?TABLE]), - rpc:call(Node, mnesia, create_table, [?TABLE, - [{ram_copies,Nodes}, - {attributes,[key,modified,value]}, - {user_properties, - [{unsplit_method,{unsplit_lib,last_modified,[]}}]}]]) - end, - lists:foreach(Init, Nodes). - -disconnect(Master, Slave)-> - rpc:call(Master, erlang, disconnect_node, [Slave]). -connect(Master, Slave)-> - rpc:call(Master, net_kernel, connect_node, [Slave]). - -write(Node, Records)-> - rpc:call(Node, ?MODULE, write, [Records]). - -write(Records)-> - Trans = fun()-> - lists:foreach(fun(Record)-> - mnesia:write(Record) - end, Records) - end, - mnesia:transaction(Trans). - -get_host()-> - [_, H] = re:split(atom_to_list(node()),"@",[{return,list}]), - list_to_atom(H). - %% {ok, HostS} = inet:gethostname(), - %% list_to_atom(HostS). - -get_path_flags() -> - [ [[" -",atom_to_list(K)," ",D] || D <- V] - || {K,V} <- init:get_arguments(), - K == pa orelse K == pz]. From 3c5a2bd30bb3abca1dd2d817db34639486084d59 Mon Sep 17 00:00:00 2001 From: Feco Boroczki Date: Thu, 26 Apr 2018 17:55:43 +0200 Subject: [PATCH 3/5] fix unsplit after inserted records --- src/unsplit_server.erl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/unsplit_server.erl b/src/unsplit_server.erl index c4bb474..958bbd6 100644 --- a/src/unsplit_server.erl +++ b/src/unsplit_server.erl @@ -248,10 +248,18 @@ run_stitch(#st{table = Tab, run_stitch(#st{table = Tab, module = M, function = F, modstate = MSt, strategy = all_keys, remote = Remote} = St) -> - Keys = mnesia:dirty_all_keys(Tab), + + RemoteKeys = rpc:call(Remote, mnesia, dirty_all_keys, [Tab]), + LocalKeys = mnesia:dirty_all_keys(Tab), +%% Keys = LocalKeys ++ (RemoteKeys -- LocalKeys), + Keys = mnesia_lib:uniq( + LocalKeys ++ RemoteKeys +%% lists:merge(lists:sort(LocalKeys), lists:sort(RemoteKeys)) + ), + lists:foldl( fun(K, Sx) -> - [_] = A = mnesia:read({Tab,K}), % assert that A is non-empty + A = mnesia:read({Tab,K}), % assert that A is non-empty B = get_remote_obj(Remote, Tab, K), if A == B -> Sx; From c7a4335b79641ca64e1e94d7fa4f66090601f575 Mon Sep 17 00:00:00 2001 From: Feco Boroczki Date: Fri, 27 Apr 2018 16:56:01 +0200 Subject: [PATCH 4/5] test with multiple nodes in 2 islands --- test/unsplit_islands_SUITE.erl | 205 +++++++++++++++++++++++++++++++++ 1 file changed, 205 insertions(+) create mode 100644 test/unsplit_islands_SUITE.erl diff --git a/test/unsplit_islands_SUITE.erl b/test/unsplit_islands_SUITE.erl new file mode 100644 index 0000000..39a9145 --- /dev/null +++ b/test/unsplit_islands_SUITE.erl @@ -0,0 +1,205 @@ +-module(unsplit_islands_SUITE). + +-include_lib("eunit/include/eunit.hrl"). +-include_lib("common_test/include/ct.hrl"). + +-export([init_per_suite/1, end_per_suite/1]). +-export([all/0]). +-export([insert_new_records/1, change_existing_records/1]). +-export([write/1, read/1]). + +-define(ERL_FLAGS, "-kernel dist_auto_connect once"). +-define(TABLE, test_table_islands). +-define(ISLAND_A, ['nodeA1', 'nodeA2', 'nodeA3']). +-define(ISLAND_B, ['nodeB1', 'nodeB2', 'nodeB3', 'nodeB4']). + +-record(?TABLE, {key, modified = erlang:timestamp(), value}). + +all() -> + [ + insert_new_records, + change_existing_records + ]. + + +init_per_suite(Conf) -> + IslandANames = ?ISLAND_A, + IslandBNames = ?ISLAND_B, + + StartNode = + fun(Node) -> + {ok, NodeName} = ct_slave:start(Node, [{erl_flags, make_erl_flags()}]), + NodeName + end, + + IslandA = lists:map(StartNode, IslandANames), + IslandB = lists:map(StartNode, IslandBNames), + + init_nodes(IslandA ++ IslandB), + + [{island_a, IslandA}, {island_b, IslandB} | Conf]. + +end_per_suite(Conf) -> + IslandA = ?config(island_a, Conf), + IslandB = ?config(island_b, Conf), + AllNodes = IslandA ++ IslandB, + + terminate_nodes(AllNodes), + StopNode = + fun(Node) -> + {ok, _NodeName} = ct_slave:stop(Node) + end, + lists:map(StopNode, AllNodes), + ok. + +insert_new_records(Conf) -> + [NodeA1 | _] = IslandA = ?config(island_a, Conf), + [NodeB1 | _] = IslandB = ?config(island_b, Conf), + AllNodes = IslandA ++ IslandB, + + check_table_size_on_nodes(AllNodes, 0), + + Element1 = #?TABLE{key = 1, value = a}, + Element2 = #?TABLE{key = 2, value = a}, + Element3 = #?TABLE{key = 3, value = b}, + Element4 = #?TABLE{key = 4, value = b}, + Element5 = #?TABLE{key = 5, value = c}, + + {atomic, ok} = write(NodeA1, [Element1, Element2]), + ct:sleep(100), + check_table_size_on_nodes(AllNodes, 2), + + disconnect_islands(IslandA, IslandB), + + {atomic, ok} = write(NodeA1, [Element3, Element4]), + {atomic, ok} = write(NodeB1, [Element5]), + + check_table_size_on_nodes(IslandA, 4), + check_table_size_on_nodes(IslandB, 3), + + connect_islands(IslandA, IslandB), + + check_table_size_on_nodes(AllNodes, 5). + +change_existing_records(Conf) -> + [NodeA1 | _] = IslandA = ?config(island_a, Conf), + [NodeB1 | _] = IslandB = ?config(island_b, Conf), + AllNodes = IslandA ++ IslandB, + + K1 = 11, + Element1V1 = #?TABLE{key = K1, value = av1, modified = 1}, + Element1V2 = #?TABLE{key = K1, value = av2, modified = 2}, + + K2 = 21, + Element2V1 = #?TABLE{key = K2, value = bv1, modified = 1}, + Element2V2 = #?TABLE{key = K2, value = bv2, modified = 2}, + + {atomic, ok} = write(NodeA1, [Element1V1]), + {atomic, ok} = write(NodeB1, [Element2V1]), + ct:sleep(100), + + check_element_on_nodes(AllNodes, K1, Element1V1), + check_element_on_nodes(AllNodes, K2, Element2V1), + + disconnect_islands(IslandA, IslandB), + + {atomic, ok} = write(NodeA1, [Element1V2]), + {atomic, ok} = write(NodeB1, [Element2V2]), + + check_element_on_nodes(IslandA, K1, Element1V2), + check_element_on_nodes(IslandA, K2, Element2V1), + check_element_on_nodes(IslandB, K1, Element1V1), + check_element_on_nodes(IslandB, K2, Element2V2), + + connect_islands(IslandA, IslandB), + + check_element_on_nodes(AllNodes, K1, Element1V2), + check_element_on_nodes(AllNodes, K2, Element2V2), + + ok. + +check_element_on_nodes(Nodes, Key, Element) -> + [check_element(Node, Key, Element) || Node <- Nodes]. + +check_element(Node, Key, Element) -> + {atomic, [Element]} = read(Node, Key). + +check_table_size_on_nodes(Nodes, Size) -> + lists:map(fun(Node) -> check_table_size_on_node(Size, Node) end, Nodes). + +check_table_size_on_node(Size, Node) -> + {Node, Size} = {Node, table_size(Node, ?TABLE)}. + +table_size(Node, Table) -> + ct_rpc:call(Node, mnesia, table_info, [Table, size]). + +terminate_nodes(Nodes) -> + Terminate = fun(Node) -> + ct_rpc:call(Node, application, stop, [unsplit]), + ct_rpc:call(Node, mnesia, stop, []), + ct_rpc:call(Node, application, stop, [sasl]) + end, + lists:foreach(Terminate, Nodes). + +init_nodes([FirstNode | _] = Nodes) -> + Init = + fun(Node) -> + {ok, [mnesia, unsplit]} = ct_rpc:call(Node, application, ensure_all_started, + [unsplit]), + {ok, _} = ct_rpc:call(Node, mnesia, change_config, + [extra_db_nodes, Nodes--[Node]]) + end, + CreateTable = + fun(Node) -> + Tables = [?TABLE, [ + {ram_copies, Nodes}, + {attributes, [key, modified, value]}, + {user_properties, [{unsplit_method, {unsplit_lib, last_modified, []}}]} + ]], + {atomic, ok} = ct_rpc:call(Node, mnesia, create_table, Tables) + end, + WaitForTables = + fun(Node) -> + ok = ct_rpc:call(Node, mnesia, wait_for_tables, [[?TABLE], 1000]) + end, + lists:foreach(Init, Nodes), + CreateTable(FirstNode), + lists:foreach(WaitForTables, Nodes). + +disconnect(Node1, Node2) -> + ct_rpc:call(Node1, erlang, disconnect_node, [Node2]). +connect(Node1, Node2) -> + ct_rpc:call(Node1, net_kernel, connect_node, [Node2]), + ct:sleep(500). + +write(Node, Records) -> + ct_rpc:call(Node, ?MODULE, write, [Records]). + +write(Records) -> + mnesia:transaction(fun() -> lists:foreach(fun mnesia:write/1, Records) end). + +read(Node, Key) -> + ct_rpc:call(Node, ?MODULE, read, [Key]). + +read(Key) -> + mnesia:transaction(fun() -> mnesia:read(?TABLE, Key) end). + +make_erl_flags() -> + ThisDir = filename:dirname(code:which(?MODULE)), + TestPath = filename:absname(ThisDir), + EbinPath = filename:absname(ThisDir ++ "/../ebin"), + lists:flatten([?ERL_FLAGS, get_path_flags(), + " -pa ", EbinPath, + " -pa ", TestPath]). + +get_path_flags() -> + [[[" -", atom_to_list(K), " ", D] || D <- V] + || {K, V} <- init:get_arguments(), + K == pa orelse K == pz]. + + +disconnect_islands(IslandA, IslandB) -> + [disconnect(NodeA, NodeB) || NodeA <- IslandA, NodeB <- IslandB]. + +connect_islands(IslandA, IslandB) -> + [connect(NodeA, NodeB) || NodeA <- IslandA, NodeB <- IslandB]. \ No newline at end of file From 08cdd55c2cd8a93589862967f98c9acf6386313a Mon Sep 17 00:00:00 2001 From: Feco Boroczki Date: Fri, 27 Apr 2018 16:57:05 +0200 Subject: [PATCH 5/5] typo fix --- test/unsplit_2nodes_SUITE.erl | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/test/unsplit_2nodes_SUITE.erl b/test/unsplit_2nodes_SUITE.erl index 7469c78..fa68f46 100644 --- a/test/unsplit_2nodes_SUITE.erl +++ b/test/unsplit_2nodes_SUITE.erl @@ -93,31 +93,31 @@ change_existing_records(Conf) -> {atomic, ok} = write(Node2, [Element2V1]), ct:sleep(100), - ckeck_element(Node1, K1, Element1V1), - ckeck_element(Node2, K1, Element1V1), - ckeck_element(Node1, K2, Element2V1), - ckeck_element(Node2, K2, Element2V1), + check_element(Node1, K1, Element1V1), + check_element(Node2, K1, Element1V1), + check_element(Node1, K2, Element2V1), + check_element(Node2, K2, Element2V1), disconnect(Node1, Node2), {atomic, ok} = write(Node1, [Element1V2]), {atomic, ok} = write(Node2, [Element2V2]), - ckeck_element(Node1, K1, Element1V2), - ckeck_element(Node2, K1, Element1V1), - ckeck_element(Node1, K2, Element2V1), - ckeck_element(Node2, K2, Element2V2), + check_element(Node1, K1, Element1V2), + check_element(Node2, K1, Element1V1), + check_element(Node1, K2, Element2V1), + check_element(Node2, K2, Element2V2), connect(Node1, Node2), - ckeck_element(Node1, K1, Element1V2), - ckeck_element(Node2, K1, Element1V2), - ckeck_element(Node1, K2, Element2V2), - ckeck_element(Node2, K2, Element2V2), + check_element(Node1, K1, Element1V2), + check_element(Node2, K1, Element1V2), + check_element(Node1, K2, Element2V2), + check_element(Node2, K2, Element2V2), ok. -ckeck_element(Node, Key, Element) -> +check_element(Node, Key, Element) -> {atomic, [Element]} = read(Node, Key). compare_table_size([Node1, Node2 | _], Table) ->