mirror of
https://github.com/valitydev/riak_test.git
synced 2024-11-06 16:45:29 +00:00
Handoff test cleanup between runs, some performance improvement;
capabilities test moves from core to kv. capabilities test updated
This commit is contained in:
parent
dab5006502
commit
84c49e23f0
@ -22,7 +22,7 @@
|
||||
-export([confirm/0]).
|
||||
-include_lib("eunit/include/eunit.hrl").
|
||||
|
||||
%% 1.4 {riak_core, handoff_data_encoding} -> [encode_raw, encode_zlib]
|
||||
%% 1.4 {riak_kv, handoff_data_encoding} -> [encode_raw, encode_zlib]
|
||||
%% 1.3 {riak_kv, anti_entropy} -> [disabled, enabled_v1]
|
||||
confirm() ->
|
||||
lager:info("Deploying mixed set of nodes"),
|
||||
@ -58,10 +58,10 @@ confirm() ->
|
||||
assert_supported(CCapabilities, {riak_kv, mapred_system}, [pipe]),
|
||||
assert_supported(CCapabilities, {riak_kv, vnode_vclocks}, [true,false]),
|
||||
assert_supported(CCapabilities, {riak_pipe, trace_format}, [ordsets,sets]),
|
||||
assert_supported(CCapabilities, {riak_core, handoff_data_encoding}, [encode_raw, encode_zlib]),
|
||||
assert_supported(CCapabilities, {riak_kv, handoff_data_encoding}, [encode_raw, encode_zlib]),
|
||||
|
||||
%% We've got a current-version node only, we should see raw selected as default:
|
||||
assert_using(CNode, {riak_core, handoff_data_encoding}, encode_raw),
|
||||
assert_using(CNode, {riak_kv, handoff_data_encoding}, encode_raw),
|
||||
|
||||
lager:info("Crash riak_core_capability server"),
|
||||
restart_capability_server(CNode),
|
||||
@ -97,7 +97,7 @@ confirm() ->
|
||||
assert_supported(LCapabilities, {riak_pipe, trace_format}, [ordsets,sets]),
|
||||
|
||||
%% We've added a legacy server: we should see zlib selected by the current-version node:
|
||||
assert_using(CNode, {riak_core, handoff_data_encoding}, encode_zlib),
|
||||
assert_using(CNode, {riak_kv, handoff_data_encoding}, encode_zlib),
|
||||
|
||||
lager:info("Crash riak_core_capability server"),
|
||||
restart_capability_server(CNode),
|
||||
@ -134,7 +134,7 @@ confirm() ->
|
||||
assert_supported(PCapabilities, {riak_pipe, trace_format}, [ordsets,sets]),
|
||||
|
||||
%% We've added a previous version (1.2) we should (still) see zlib selected:
|
||||
assert_using(CNode, {riak_core, handoff_data_encoding}, encode_zlib),
|
||||
assert_using(CNode, {riak_kv, handoff_data_encoding}, encode_zlib),
|
||||
|
||||
lager:info("Upgrade Legacy node"),
|
||||
rt:upgrade(LNode, current),
|
||||
@ -143,7 +143,7 @@ confirm() ->
|
||||
lager:info("Verify staged_joins == true after upgrade of legacy -> current"),
|
||||
|
||||
%% We have upgraded the legacy node, but we should see zlib selected (previous node still not upgraded):
|
||||
assert_using(CNode, {riak_core, handoff_data_encoding}, encode_zlib);
|
||||
assert_using(CNode, {riak_kv, handoff_data_encoding}, encode_zlib);
|
||||
|
||||
_ ->
|
||||
lager:info("Legacy Riak not available, skipping legacy tests"),
|
||||
@ -206,7 +206,7 @@ confirm() ->
|
||||
assert_supported(CCap2, {riak_pipe, trace_format}, [ordsets,sets]),
|
||||
|
||||
%% We've upgraded both legacy and previous versions; we should see raw selected by everyone:
|
||||
[assert_using(Node, {riak_core, handoff_data_encoding}, encode_raw) || Node <- [CNode, PNode, LNode]],
|
||||
[assert_using(Node, {riak_kv, handoff_data_encoding}, encode_raw) || Node <- [CNode, PNode, LNode]],
|
||||
|
||||
%% All nodes are now current version. Test override behavior.
|
||||
Override = fun(undefined, Prefer) ->
|
||||
|
@ -40,6 +40,10 @@ run_test(TestMode, NTestItems, NTestNodes, HandoffEncoding) ->
|
||||
|
||||
lager:info("Testing handoff (items ~p, encoding: ~p)", [NTestItems, HandoffEncoding]),
|
||||
|
||||
%% This resets nodes, cleans up stale directories, etc.:
|
||||
lager:info("Cleaning up..."),
|
||||
rt:setup_harness(dummy, dummy),
|
||||
|
||||
lager:info("Spinning up test nodes"),
|
||||
[RootNode | TestNodes] = Nodes = deploy_test_nodes(TestMode, NTestNodes),
|
||||
|
||||
@ -84,13 +88,13 @@ run_test(TestMode, NTestItems, NTestNodes, HandoffEncoding) ->
|
||||
lager:info("Testing handoff for cluster."),
|
||||
lists:foreach(fun(TestNode) -> test_handoff(RootNode, TestNode, NTestItems) end, TestNodes),
|
||||
|
||||
%% Prepare for the next call to our test:
|
||||
%% Prepare for the next call to our test (we aren't polite about it, it's faster that way):
|
||||
lager:info("Bringing down test nodes."),
|
||||
lists:foreach(fun(N) -> rt:leave(N), timer:sleep(50000), rt:wait_until_unpingable(N) end, TestNodes),
|
||||
lists:foreach(fun(N) -> rt:brutal_kill(N) end, TestNodes),
|
||||
|
||||
%% The "root" node can't leave() since it's the only node left:
|
||||
lager:info("Stopping root node."),
|
||||
rt:stop(RootNode), rt:wait_until_unpingable(RootNode).
|
||||
rt:brutal_kill(RootNode).
|
||||
|
||||
%% See if we get the same data back from our new nodes as we put into the root node:
|
||||
test_handoff(RootNode, NewNode, NTestItems) ->
|
||||
@ -100,7 +104,7 @@ test_handoff(RootNode, NewNode, NTestItems) ->
|
||||
|
||||
lager:info("Joining new node with cluster."),
|
||||
rt:join(NewNode, RootNode),
|
||||
timer:sleep(3000),
|
||||
?assertEqual(ok, rt:wait_until_nodes_ready([RootNode, NewNode])),
|
||||
rt:wait_until_no_pending_changes([RootNode, NewNode]),
|
||||
|
||||
%% See if we get the same data back from the joined node that we added to the root node.
|
||||
|
Loading…
Reference in New Issue
Block a user