Skip to content

Commit 3f19fe9

Browse files
jvoegelepaulhenrich
authored andcommitted
Testing for record encapsulation (#1181)
* Test that listkeys works in mixed cluster prior to record refactor * Fail listkeys test early if possible * Fix rebar.config.lock
1 parent cc1cd74 commit 3f19fe9

File tree

2 files changed

+65
-2
lines changed

2 files changed

+65
-2
lines changed

src/rt.erl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,8 +1318,10 @@ systest_verify_delete(Node, Start, End, Bucket, R) ->
13181318
systest_write(Node, Size) ->
13191319
systest_write(Node, Size, 2).
13201320

1321-
systest_write(Node, Size, W) ->
1322-
systest_write(Node, 1, Size, <<"systest">>, W).
1321+
systest_write(Node, Size, W) when is_integer(W) ->
1322+
systest_write(Node, 1, Size, <<"systest">>, W);
1323+
systest_write(Node, Size, Bucket) ->
1324+
systest_write(Node, 1, Size, Bucket, 2).
13231325

13241326
systest_write(Node, Start, End, Bucket, W) ->
13251327
systest_write(Node, Start, End, Bucket, W, <<>>).
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
%% -------------------------------------------------------------------
2+
%%
3+
%% Copyright (c) 2016 Basho Technologies, Inc.
4+
%%
5+
%% This file is provided to you under the Apache License,
6+
%% Version 2.0 (the "License"); you may not use this file
7+
%% except in compliance with the License. You may obtain
8+
%% a copy of the License at
9+
%%
10+
%% http://www.apache.org/licenses/LICENSE-2.0
11+
%%
12+
%% Unless required by applicable law or agreed to in writing,
13+
%% software distributed under the License is distributed on an
14+
%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
%% KIND, either express or implied. See the License for the
16+
%% specific language governing permissions and limitations
17+
%% under the License.
18+
%%
19+
%% -------------------------------------------------------------------
20+
-module(kv_vnode_requests_upgrade_downgrade).
21+
22+
-include_lib("eunit/include/eunit.hrl").
23+
24+
-export([confirm/0]).
25+
26+
-define(NUM_KEYS, 100).
27+
-define(BUCKET, <<"ale">>).
28+
-define(CLUSTER_SIZE, 5).
29+
-define(CONFIG, []).
30+
31+
confirm() ->
32+
Cluster = [Node| _ ] = rt:build_cluster(lists:duplicate(?CLUSTER_SIZE, {lts, ?CONFIG})),
33+
Clients = [rt:pbc(N) || N <- Cluster],
34+
35+
lager:info("Writing ~p keys", [?NUM_KEYS]),
36+
rt:systest_write(Node, ?NUM_KEYS, ?BUCKET),
37+
38+
Before = count_keys(Clients, ?BUCKET),
39+
ExpectedCounts = lists:duplicate(?CLUSTER_SIZE, ?NUM_KEYS),
40+
?assertEqual(Before, ExpectedCounts),
41+
42+
perform_upgrade(Cluster, current, 3),
43+
44+
After = count_keys(Clients, ?BUCKET),
45+
?assertEqual(Before, After),
46+
pass.
47+
48+
count_keys(Clients, Bucket) when is_list(Clients) ->
49+
[count_keys(Client, Bucket) || Client <- Clients];
50+
count_keys(Client, Bucket) ->
51+
{ok, Keys} = riakc_pb_socket:list_keys(Client, Bucket, 5000),
52+
length(Keys).
53+
54+
perform_upgrade(Node, Version) ->
55+
lager:info("Upgrading node ~p", [Node]),
56+
rt:upgrade(Node, Version),
57+
lager:info("Upgrade finished on node ~p", [Node]),
58+
rt:wait_for_service(Node, riak_kv).
59+
perform_upgrade(Cluster, Version, TakeN) ->
60+
lists:foreach(fun(Node) -> perform_upgrade(Node, Version) end,
61+
lists:sublist(Cluster, TakeN)).

0 commit comments

Comments
 (0)