Skip to content

Commit ccf2b5b

Browse files
author
Brett Hazen
authored
Merge pull request #1276 from basho/bch-adjust-list-key-test
Fix test failures caused by riak client not allowing list keys
2 parents 5e3b102 + bbb85a2 commit ccf2b5b

18 files changed

+80
-50
lines changed

tests/bucket_types.erl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
confirm() ->
99
application:start(inets),
1010
lager:info("Deploy some nodes"),
11+
12+
%% Allow listing of buckets and keys for testing
13+
application:set_env(riakc, allow_listing, true),
14+
1115
Nodes = rt:build_cluster(4, [], [
1216
{riak_core, [{default_bucket_props,
1317
[

tests/http_security.erl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
-define(assertDenied(Op), ?assertMatch({error, {forbidden, _}}, Op)).
1212

1313
confirm() ->
14+
%% Allow listing of buckets and keys for testing
15+
application:set_env(riakc, allow_listing, true),
16+
1417
application:start(crypto),
1518
application:start(asn1),
1619
application:start(public_key),

tests/overload.erl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
%% -------------------------------------------------------------------
22
%%
3-
%% Copyright (c) 2013 Basho Technologies, Inc.
3+
%% Copyright (c) 2013-2017 Basho Technologies, Inc.
44
%%
55
%% This file is provided to you under the Apache License,
66
%% Version 2.0 (the "License"); you may not use this file
@@ -81,6 +81,9 @@ default_config(#config{
8181
{riak_api, [{pb_backlog, 1024}]}].
8282

8383
confirm() ->
84+
%% Allow listing of buckets and keys for testing
85+
application:set_env(riakc, allow_listing, true),
86+
8487
[Node1 | _] = Nodes = setup(),
8588

8689
ok = create_bucket_type(Nodes, ?NORMAL_TYPE, [{n_val, 3}]),

tests/pb_security.erl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
-define(assertDenied(Op), ?assertMatch({error, <<"Permission",_/binary>>}, Op)).
1212

1313
confirm() ->
14+
%% Allow listing of buckets and keys for testing
15+
application:set_env(riakc, allow_listing, true),
16+
1417
application:start(crypto),
1518
application:start(asn1),
1619
application:start(public_key),

tests/rolling_capabilities.erl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
%% -------------------------------------------------------------------
22
%%
3-
%% Copyright (c) 2012 Basho Technologies, Inc.
3+
%% Copyright (c) 2012-2017 Basho Technologies, Inc.
44
%%
55
%% This file is provided to you under the Apache License,
66
%% Version 2.0 (the "License"); you may not use this file
@@ -23,6 +23,9 @@
2323
-include_lib("eunit/include/eunit.hrl").
2424

2525
confirm() ->
26+
%% Allow listing of buckets and keys for testing
27+
application:set_env(riakc, allow_listing, true),
28+
2629
TestMetaData = riak_test_runner:metadata(),
2730
Count = 4,
2831
OldVsn = proplists:get_value(upgrade_version, TestMetaData, previous),

tests/ts_cluster_capabilities_SUITE.erl

Lines changed: 17 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
%% -------------------------------------------------------------------
22
%%
3-
%% Copyright (c) 2016 Basho Technologies, Inc.
3+
%% Copyright (c) 2016-2017 Basho Technologies, Inc.
44
%%
55
%% This file is provided to you under the Apache License,
66
%% Version 2.0 (the "License"); you may not use this file
@@ -30,19 +30,13 @@
3030
%%--------------------------------------------------------------------
3131

3232
-define(TS_VERSION_CURRENT, "current").
33-
34-
%% git checkout riak_ts-1.3.1 && make locked-deps
35-
-define(TS_VERSION_1_3, riak_ts_1_3_1).
36-
3733
-define(SQL_SELECT_CAP, {riak_kv, sql_select_version}).
3834

3935
suite() ->
4036
[{timetrap,{minutes,10}}].
4137

4238
init_per_suite(Config) ->
43-
Versions = rt:find_version_by_name(["riak_ts-1.3.1", "riak_ts_ee-1.3.1"]),
44-
Vsn131 = maybe_missing_1_3_1(Versions),
45-
[{?TS_VERSION_1_3, Vsn131} | Config].
39+
Config.
4640

4741
end_per_suite(_Config) ->
4842
ok.
@@ -143,21 +137,19 @@ capability_not_specified_on_one_node_test(_Ctx) ->
143137
%% Riak TS Capability Tests
144138
%%--------------------------------------------------------------------
145139

146-
sql_select_upgrade_a_node_from_1_3_test(Config) ->
147-
Vsn131 = ?config(?TS_VERSION_1_3, Config),
140+
sql_select_upgrade_a_node_from_legacy_test(_Ctx) ->
148141
[Node_A, Node_B, Node_C] =
149-
rt:deploy_nodes([Vsn131, Vsn131, Vsn131]),
142+
rt:deploy_nodes([legacy, legacy, legacy]),
150143
ok = rt:join_cluster([Node_A,Node_B,Node_C]),
151144
ok = rt:wait_until_ring_converged([Node_A,Node_B,Node_C]),
152145
ok = rt:upgrade(Node_A, ?TS_VERSION_CURRENT),
153146
ok = rt:wait_until_ring_converged([Node_A,Node_B,Node_C]),
154-
ok = rt:wait_until_capability(Node_A, ?SQL_SELECT_CAP, v1),
147+
ok = rt:wait_until_capability(Node_A, ?SQL_SELECT_CAP, v2),
155148
ok.
156149

157-
sql_select_join_with_all_nodes_upgraded_test(Config) ->
158-
Vsn131 = ?config(?TS_VERSION_1_3, Config),
150+
sql_select_join_with_all_nodes_upgraded_test(_Ctx) ->
159151
[Node_A, Node_B, Node_C] =
160-
rt:deploy_nodes([Vsn131, Vsn131, Vsn131]),
152+
rt:deploy_nodes([legacy, legacy, legacy]),
161153
ok = rt:join_cluster([Node_A,Node_B,Node_C]),
162154
rt:wait_until_ring_converged([Node_A,Node_B,Node_C]),
163155
rt:upgrade(Node_A, ?TS_VERSION_CURRENT),
@@ -168,18 +160,14 @@ sql_select_join_with_all_nodes_upgraded_test(Config) ->
168160
rt:wait_until_capability(Node_C, ?SQL_SELECT_CAP, v3),
169161
ok.
170162

171-
%% This test passed for 1.4.0, expecting v1 where commented, but fails for 1.5.0 due to code change. We set it to expect
172-
%% v3 until future changes are made. After 1.5.0 if this test will fail if new code is introduced to handle capability
173-
%% communication. https://bashoeng.atlassian.net/browse/RTS-1415
174-
sql_select_downgrade_a_node_test(Config) ->
175-
Vsn131 = ?config(?TS_VERSION_1_3, Config),
163+
sql_select_downgrade_a_node_test(_Ctx) ->
176164
[Node_A, Node_B, Node_C] =
177-
rt:deploy_nodes([Vsn131, ?TS_VERSION_CURRENT, ?TS_VERSION_CURRENT]),
165+
rt:deploy_nodes([legacy, ?TS_VERSION_CURRENT, ?TS_VERSION_CURRENT]),
178166
ok = rt:join_cluster([Node_A,Node_B,Node_C]),
179167
rt:wait_until_ring_converged([Node_A,Node_B,Node_C]),
180168
% rt:wait_until_capability(Node_A, ?SQL_SELECT_CAP, v3),
181-
rt:wait_until_capability(Node_B, ?SQL_SELECT_CAP, v1),
182-
rt:wait_until_capability(Node_C, ?SQL_SELECT_CAP, v1),
169+
rt:wait_until_capability(Node_B, ?SQL_SELECT_CAP, v2),
170+
rt:wait_until_capability(Node_C, ?SQL_SELECT_CAP, v2),
183171
rt:upgrade(Node_A, ?TS_VERSION_CURRENT),
184172
rt:wait_until_ring_converged([Node_A,Node_B,Node_C]),
185173
rt:wait_until_capability(Node_A, ?SQL_SELECT_CAP, v3),
@@ -189,8 +177,8 @@ sql_select_downgrade_a_node_test(Config) ->
189177
%% pending changes to how capabilities are communicated around the ring, this
190178
%% section will expect v2. Once capabilities are changed in a future version of riak
191179
%% (or if testing 1.4.0 as current)
192-
%% the expected version should go back to v1.
193-
rt:upgrade(Node_A, Vsn131),
180+
%% the expected version should go back to v2.
181+
rt:upgrade(Node_A, legacy),
194182
rt:wait_until_ring_converged([Node_A,Node_B,Node_C]),
195183
rt:wait_until_capability(Node_B, ?SQL_SELECT_CAP, v3),
196184
rt:wait_until_capability(Node_C, ?SQL_SELECT_CAP, v3),
@@ -200,10 +188,9 @@ sql_select_downgrade_a_node_test(Config) ->
200188
%% Perform queries in mixed version cluster
201189
%%--------------------------------------------------------------------
202190

203-
query_in_mixed_version_cluster_test(Config) ->
204-
Vsn131 = ?config(?TS_VERSION_1_3, Config),
191+
query_in_mixed_version_cluster_test(_Ctx) ->
205192
[Node_A, Node_B, Node_C] =
206-
rt:deploy_nodes([?TS_VERSION_CURRENT, Vsn131, ?TS_VERSION_CURRENT]),
193+
rt:deploy_nodes([?TS_VERSION_CURRENT, previous, ?TS_VERSION_CURRENT]),
207194
ok = rt:join_cluster([Node_A,Node_B,Node_C]),
208195
rt:wait_until_ring_converged([Node_A,Node_B,Node_C]),
209196
Table = "grouptab1",
@@ -220,7 +207,7 @@ query_in_mixed_version_cluster_test(Config) ->
220207
[{1,1,B*C} || B <- lists:seq(1,10), C <- lists:seq(1000,5000,1000)]),
221208
ExpectedResultSet = [{N} || N <- lists:seq(1000,5000,1000)],
222209
%%
223-
%% Test that the current version can query version 1.3
210+
%% Test that the current version can query older version
224211
%%
225212
Query =
226213
"SELECT c FROM grouptab1 "
@@ -232,17 +219,11 @@ query_in_mixed_version_cluster_test(Config) ->
232219
{ok,{Cols, Rows}}
233220
),
234221
%%
235-
%% Test that the 1.3 can query the current version
222+
%% Test that the previous can query the current version
236223
%%
237224
{ok, {Cols, Rows}} = run_query(rt:pbc(Node_B), Query),
238225
ts_data:assert_row_sets(
239226
{rt_ignore_columns, ExpectedResultSet},
240227
{ok,{Cols, Rows}}
241228
).
242229

243-
%% If 1.3.1 is not found, use a meaningful atom to prompt the error message
244-
%% rtdev:check_version/1
245-
maybe_missing_1_3_1([]) ->
246-
missing_version_ts_1_3_1;
247-
maybe_missing_1_3_1([Vsn]) ->
248-
Vsn.

tests/ts_cluster_comprehensive.erl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
% -------------------------------------------------------------------
22
%%
3-
%% Copyright (c) 2015 Basho Technologies, Inc.
3+
%% Copyright (c) 2015-2017 Basho Technologies, Inc.
44
%%
55
%% This file is provided to you under the Apache License,
66
%% Version 2.0 (the "License"); you may not use this file
@@ -39,6 +39,9 @@ confirm() ->
3939
run_tests(?PVAL_P1, ?PVAL_P2).
4040

4141
run_tests(PvalP1, PvalP2) ->
42+
%% Allow listing of buckets and keys for testing
43+
application:set_env(riakc, allow_listing, true),
44+
4245
Data = make_data(PvalP1, PvalP2),
4346
io:format("Data to be written:\n~p\n...\n~p\n", [hd(Data), lists:last(Data)]),
4447

tests/ts_cluster_list_irreg_keys_SUITE.erl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
%% -------------------------------------------------------------------
22
%%
3-
%% Copyright (c) 2016 Basho Technologies, Inc.
3+
%% Copyright (c) 2016-2017 Basho Technologies, Inc.
44
%%
55
%% This file is provided to you under the Apache License,
66
%% Version 2.0 (the "License"); you may not use this file
@@ -39,6 +39,9 @@
3939
%%--------------------------------------------------------------------
4040

4141
suite() ->
42+
%% Allow listing of buckets and keys for testing
43+
application:set_env(riakc, allow_listing, true),
44+
4245
[{timetrap,{minutes,10}}].
4346

4447
init_per_suite(Config) ->

tests/ts_cluster_stream_list_keys_SUITE.erl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
%% -------------------------------------------------------------------
22
%%
3-
%% Copyright (c) 2016 Basho Technologies, Inc.
3+
%% Copyright (c) 2016-2017 Basho Technologies, Inc.
44
%%
55
%% This file is provided to you under the Apache License,
66
%% Version 2.0 (the "License"); you may not use this file
@@ -31,6 +31,9 @@
3131
%%--------------------------------------------------------------------
3232

3333
suite() ->
34+
%% Allow listing of buckets and keys for testing
35+
application:set_env(riakc, allow_listing, true),
36+
3437
[{timetrap,{minutes,10}}].
3538

3639
init_per_suite(Config) ->

tests/ts_simple_pb_security_SUITE.erl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
%% -------------------------------------------------------------------
22
%%
3-
%% Copyright (c) 2016 Basho Technologies, Inc.
3+
%% Copyright (c) 2016-2017 Basho Technologies, Inc.
44
%%
55
%% This file is provided to you under the Apache License,
66
%% Version 2.0 (the "License"); you may not use this file
@@ -31,6 +31,9 @@
3131
%%--------------------------------------------------------------------
3232

3333
suite() ->
34+
%% Allow listing of buckets and keys for testing
35+
application:set_env(riakc, allow_listing, true),
36+
3437
[{timetrap,{minutes,10}}].
3538

3639
init_per_suite(Config) ->

0 commit comments

Comments
 (0)