summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBrad Anderson <brad@cloudant.com>2010-03-31 12:40:50 -0400
committerBrad Anderson <brad@cloudant.com>2010-05-09 22:56:23 -0400
commit99a4d65b3b4158e26bdf97c644b8a60f6146c92d (patch)
treee77681ed6a3dfd694c688fa43dfbb3644d6cf90c /test
parent23c494acf0967770a08ba9d72085887dedbc8ccd (diff)
first stab at mem3's join new node functionality
Diffstat (limited to 'test')
-rw-r--r--test/mem3_test.erl19
1 files changed, 18 insertions, 1 deletions
diff --git a/test/mem3_test.erl b/test/mem3_test.erl
index d5420ba3..139187df 100644
--- a/test/mem3_test.erl
+++ b/test/mem3_test.erl
@@ -6,6 +6,12 @@
-define(HINT_C1, 365375409332725729550921208179070754913983135744).
-define(HINT_C2, 1096126227998177188652763624537212264741949407232).
+-define(PARTS_FOR_D1, [365375409332725729550921208179070754913983135744,
+ 548063113999088594326381812268606132370974703616,
+ 730750818665451459101842416358141509827966271488,
+ 913438523331814323877303020447676887284957839360,
+ 1096126227998177188652763624537212264741949407232,
+ 1278813932664540053428224228626747642198940975104]).
%% TEST SETUP
@@ -21,7 +27,8 @@ all_tests_test_() ->
fun init/1,
fun clock/1,
fun join_first/1,
- fun join_first_with_hints/1
+ fun join_first_with_hints/1,
+ fun join_new_node/1
]}
end}
]
@@ -76,3 +83,13 @@ join_first_with_hints(_Pid) ->
?assertEqual([c,d,e], mem3:nodes_for_part(?HINT_C1)),
?assertEqual([c,d,e], mem3:nodes_for_part(?HINT_C2)),
ok.
+
+
+join_new_node(_Pid) ->
+ mem3:join(first, [{1, a, []}, {2, b, []}, {3, c, []}]),
+ ?assertEqual(24, length(mem3:fullmap())),
+ ?assertEqual([], mem3:parts_for_node(d)),
+ mem3:join(new, [{4, d, []}]),
+ ?assertEqual(?PARTS_FOR_D1, mem3:parts_for_node(d)),
+ ?debugFmt("~nFullmap: ~p~n", [mem3:fullmap()]),
+ ok.