riak_test/tests/verify_basic_upgrade.erl

49 lines
1.6 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.
%%
%% -------------------------------------------------------------------
-module(verify_basic_upgrade).
2012-12-14 15:50:49 +00:00
-behavior(riak_test).
-export([confirm/0]).
-include_lib("eunit/include/eunit.hrl").
confirm() ->
2012-11-15 18:54:50 +00:00
TestMetaData = riak_test_runner:metadata(),
OldVsn = proplists:get_value(upgrade_version, TestMetaData, previous),
Nodes = [Node1|_] = rt:build_cluster([OldVsn, OldVsn, OldVsn, OldVsn]),
lager:info("Writing 100 keys to ~p", [Node1]),
rt:systest_write(Node1, 100, 3),
?assertEqual([], rt:systest_read(Node1, 100, 1)),
2012-11-15 18:54:50 +00:00
[upgrade(Node, current) || Node <- Nodes],
2012-11-15 18:54:50 +00:00
%% Umm.. technically, it'd downgrade
[upgrade(Node, OldVsn) || Node <- Nodes],
pass.
2012-11-15 18:54:50 +00:00
upgrade(Node, NewVsn) ->
lager:info("Upgrading ~p to ~p", [Node, NewVsn]),
rt:upgrade(Node, NewVsn),
rt:wait_for_service(Node, riak_kv),
lager:info("Ensuring keys still exist"),
2012-11-15 18:54:50 +00:00
rt:systest_read(Node, 100, 1),
?assertEqual([], rt:systest_read(Node, 100, 1)),
ok.