riak_test/tests/gh_riak_core_154.erl

58 lines
2.0 KiB
Erlang
Raw Normal View History

2012-10-10 22:14:06 +00:00
%% -------------------------------------------------------------------
%%
%% Copyright (c) 2012 Basho Technologies, Inc.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
%% except in compliance with the License. You may obtain
%% a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing,
%% software distributed under the License is distributed on an
%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
%% KIND, either express or implied. See the License for the
%% specific language governing permissions and limitations
%% under the License.
%%
%% -------------------------------------------------------------------
2012-04-05 09:05:39 +00:00
%% Automated test for issue riak_core#154
%% Hinted handoff does not occur after a node has been restarted in Riak 1.1
-module(gh_riak_core_154).
2012-12-14 15:50:49 +00:00
-behavior(riak_test).
-export([confirm/0]).
2012-04-05 09:05:39 +00:00
-include_lib("eunit/include/eunit.hrl").
confirm() ->
%% Increase handoff concurrency on nodes
2012-04-05 09:05:39 +00:00
NewConfig = [{riak_core, [{handoff_concurrency, 1024}]}],
Nodes = rt:build_cluster(2, NewConfig),
2012-09-27 17:01:46 +00:00
?assertEqual(ok, rt:wait_until_nodes_ready(Nodes)),
[Node1, Node2] = Nodes,
2012-04-05 09:05:39 +00:00
lager:info("Write data while ~p is offline", [Node2]),
rt:stop(Node2),
2012-09-27 18:31:21 +00:00
lager:info("Sleeping for 10 seconds while node stops"),
timer:sleep(10000),
2012-04-05 09:05:39 +00:00
?assertEqual([], rt:systest_write(Node1, 1000, 3)),
lager:info("Verify that ~p is missing data", [Node2]),
rt:start(Node2),
rt:stop(Node1),
?assertMatch([{_,{error,notfound}}|_],
rt:systest_read(Node2, 1000, 3)),
lager:info("Restart ~p and sleep for 5 min, allowing handoff to occur",
[Node1]),
rt:start(Node1),
timer:sleep(300000),
lager:info("Verify that ~p has all data", [Node2]),
rt:stop(Node1),
?assertEqual([], rt:systest_read(Node2, 1000, 3)),
lager:info("gh_riak_core_154: passed"),
pass.