Skip to content

Commit 46c01a8

Browse files
korry8911Brett Hazen
authored andcommitted
undoing gset tests
1 parent 692c3dd commit 46c01a8

File tree

2 files changed

+17
-61
lines changed

2 files changed

+17
-61
lines changed

tests/verify_crdt_capability.erl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ confirm() ->
6969
riak_dt_orswot,
7070
riak_dt_map,
7171
pncounter,
72-
riak_kv_hll,
73-
riak_dt_gset])),
72+
riak_kv_hll])),
7473
?assertMatch(ok, rhc:counter_incr(PrevHttp, ?BUCKET, ?KEY, 1)),
7574
?assertMatch({ok, 5}, rhc:counter_val(PrevHttp, ?BUCKET, ?KEY)),
7675

tests/verify_dt_converge.erl

Lines changed: 16 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,10 @@
3333
-define(STYPE, <<"sets">>).
3434
-define(MTYPE, <<"maps">>).
3535
-define(HTYPE, <<"hlls">>).
36-
-define(GSTYPE, <<"gsets">>).
3736
-define(TYPES, [{?CTYPE, counter},
3837
{?STYPE, set},
3938
{?MTYPE, map},
40-
{?HTYPE, hll},
41-
{?GSTYPE, gset}]).
39+
{?HTYPE, hll}]).
4240

4341
-define(PB_BUCKET, <<"pbtest">>).
4442
-define(HTTP_BUCKET, <<"httptest">>).
@@ -62,17 +60,17 @@ confirm() ->
6260

6361
%% Do some updates to each type
6462
[update_1(Type, ?PB_BUCKET, Client, riakc_pb_socket) ||
65-
{Type, Client} <- lists:zip(?TYPES, [P1, P2, P3, P4, P4])],
63+
{Type, Client} <- lists:zip(?TYPES, [P1, P2, P3, P4])],
6664

6765
[update_1(Type, ?HTTP_BUCKET, Client, rhc) ||
68-
{Type, Client} <- lists:zip(?TYPES, [H1, H2, H3, H4, H3])],
66+
{Type, Client} <- lists:zip(?TYPES, [H1, H2, H3, H4])],
6967

7068
%% Check that the updates are stored
7169
[check_1(Type, ?PB_BUCKET, Client, riakc_pb_socket) ||
72-
{Type, Client} <- lists:zip(?TYPES, [P4, P3, P2, P1, P2])],
70+
{Type, Client} <- lists:zip(?TYPES, [P4, P3, P2, P1])],
7371

7472
[check_1(Type, ?HTTP_BUCKET, Client, rhc) ||
75-
{Type, Client} <- lists:zip(?TYPES, [H4, H3, H2, H1, H4])],
73+
{Type, Client} <- lists:zip(?TYPES, [H4, H3, H2, H1])],
7674

7775
lager:info("Partition cluster in two."),
7876

@@ -81,34 +79,34 @@ confirm() ->
8179
lager:info("Modify data on side 1"),
8280
%% Modify one side
8381
[update_2a(Type, ?PB_BUCKET, Client, riakc_pb_socket) ||
84-
{Type, Client} <- lists:zip(?TYPES, [P1, P2, P1, P2, P1])],
82+
{Type, Client} <- lists:zip(?TYPES, [P1, P2, P1, P2])],
8583

8684
[update_2a(Type, ?HTTP_BUCKET, Client, rhc) ||
87-
{Type, Client} <- lists:zip(?TYPES, [H1, H2, H1, H2, H1])],
85+
{Type, Client} <- lists:zip(?TYPES, [H1, H2, H1, H2])],
8886

8987
lager:info("Check data is unmodified on side 2"),
9088
%% check value on one side is different from other
9189
[check_2b(Type, ?PB_BUCKET, Client, riakc_pb_socket) ||
92-
{Type, Client} <- lists:zip(?TYPES, [P4, P3, P4, P3, P4])],
90+
{Type, Client} <- lists:zip(?TYPES, [P4, P3, P4, P3])],
9391

9492
[check_2b(Type, ?HTTP_BUCKET, Client, rhc) ||
95-
{Type, Client} <- lists:zip(?TYPES, [H4, H3, H4, H3, H4])],
93+
{Type, Client} <- lists:zip(?TYPES, [H4, H3, H4, H3])],
9694

9795
lager:info("Modify data on side 2"),
9896
%% Modify other side
9997
[update_3b(Type, ?PB_BUCKET, Client, riakc_pb_socket) ||
100-
{Type, Client} <- lists:zip(?TYPES, [P3, P4, P3, P4, P3])],
98+
{Type, Client} <- lists:zip(?TYPES, [P3, P4, P3, P4])],
10199

102100
[update_3b(Type, ?HTTP_BUCKET, Client, rhc) ||
103-
{Type, Client} <- lists:zip(?TYPES, [H3, H4, H3, H4, H3])],
101+
{Type, Client} <- lists:zip(?TYPES, [H3, H4, H3, H4])],
104102

105103
lager:info("Check data is unmodified on side 1"),
106104
%% verify values differ
107105
[check_3a(Type, ?PB_BUCKET, Client, riakc_pb_socket) ||
108-
{Type, Client} <- lists:zip(?TYPES, [P2, P2, P1, P1, P2])],
106+
{Type, Client} <- lists:zip(?TYPES, [P2, P2, P1, P1])],
109107

110108
[check_3a(Type, ?HTTP_BUCKET, Client, rhc) ||
111-
{Type, Client} <- lists:zip(?TYPES, [H2, H2, H1, H1, H2])],
109+
{Type, Client} <- lists:zip(?TYPES, [H2, H2, H1, H1])],
112110

113111
%% heal
114112
lager:info("Heal and check merged values"),
@@ -201,13 +199,6 @@ update_1({BType, hll}, Bucket, Client, CMod) ->
201199
fun(S) ->
202200
riakc_hll:add_element(<<"Z">>, S)
203201
end,
204-
{BType, Bucket}, ?KEY, ?MODIFY_OPTS);
205-
update_1({BType, gset}, Bucket, Client, CMod) ->
206-
lager:info("update_1: Updating hyperloglog(set)"),
207-
CMod:modify_type(Client,
208-
fun(S) ->
209-
riakc_gset:add_element(<<"Z">>, S)
210-
end,
211202
{BType, Bucket}, ?KEY, ?MODIFY_OPTS).
212203

213204
check_1({BType, counter}, Bucket, Client, CMod) ->
@@ -223,10 +214,7 @@ check_1({BType, map}, Bucket, Client, CMod) ->
223214
{{<<"friends">>, set}, [<<"Russell">>]}]);
224215
check_1({BType, hll}, Bucket, Client, CMod) ->
225216
lager:info("check_1: Checking hll value is correct"),
226-
check_value(Client,CMod,{BType, Bucket},?KEY,riakc_hll,1);
227-
check_1({BType, gset}, Bucket, Client, CMod) ->
228-
lager:info("check_1: Checking hll value is correct"),
229-
check_value(Client,CMod,{BType, Bucket},?KEY,riakc_gset, [<<"Z">>]).
217+
check_value(Client,CMod,{BType, Bucket},?KEY,riakc_hll,1).
230218

231219
update_2a({BType, counter}, Bucket, Client, CMod) ->
232220
CMod:modify_type(Client,
@@ -263,14 +251,6 @@ update_2a({BType, hll}, Bucket, Client, CMod) ->
263251
<<"DANG">>,
264252
riakc_hll:add_element(<<"Z^2">>, S))
265253
end,
266-
{BType, Bucket}, ?KEY, ?MODIFY_OPTS);
267-
update_2a({BType, gset}, Bucket, Client, CMod) ->
268-
CMod:modify_type(Client,
269-
fun(S) ->
270-
riakc_gset:add_element(
271-
<<"DANG">>,
272-
riakc_gset:add_element(<<"Z^2">>, S))
273-
end,
274254
{BType, Bucket}, ?KEY, ?MODIFY_OPTS).
275255

276256

@@ -287,11 +267,7 @@ check_2b({BType, map},Bucket,Client,CMod) ->
287267
{{<<"friends">>, set}, [<<"Russell">>]}]);
288268
check_2b({BType, hll},Bucket,Client,CMod) ->
289269
lager:info("check_2b: Checking hll value is unchanged"),
290-
check_value(Client, CMod, {BType, Bucket}, ?KEY, riakc_hll, 1);
291-
check_2b({BType, gset},Bucket,Client,CMod) ->
292-
lager:info("check_2b: Checking gset value is unchanged"),
293-
check_value(Client, CMod, {BType, Bucket}, ?KEY, riakc_gset, [<<"Z">>]).
294-
270+
check_value(Client, CMod, {BType, Bucket}, ?KEY, riakc_hll, 1).
295271

296272
update_3b({BType, counter}, Bucket, Client, CMod) ->
297273
CMod:modify_type(Client,
@@ -327,15 +303,8 @@ update_3b({BType, hll}, Bucket, Client, CMod) ->
327303
fun(S) ->
328304
riakc_hll:add_element(<<"Zedds Dead">>, S)
329305
end,
330-
{BType, Bucket}, ?KEY, ?MODIFY_OPTS);
331-
update_3b({BType, gset}, Bucket, Client, CMod) ->
332-
CMod:modify_type(Client,
333-
fun(S) ->
334-
riakc_gset:add_element(<<"Zedd's Dead">>, S)
335-
end,
336306
{BType, Bucket}, ?KEY, ?MODIFY_OPTS).
337307

338-
339308
check_3a({BType, counter}, Bucket, Client, CMod) ->
340309
lager:info("check_3a: Checking counter value is unchanged"),
341310
check_value(Client,CMod,{BType, Bucket},?KEY,riakc_counter,-5);
@@ -351,10 +320,7 @@ check_3a({BType, map}, Bucket, Client, CMod) ->
351320
{{<<"verified">>, flag}, true}]);
352321
check_3a({BType, hll}, Bucket, Client, CMod) ->
353322
lager:info("check_3a: Checking hll value is unchanged"),
354-
check_value(Client,CMod,{BType, Bucket},?KEY,riakc_hll,3);
355-
check_3a({BType, gset}, Bucket, Client, CMod) ->
356-
lager:info("check_3a: Checking gset value is unchanged"),
357-
check_value(Client,CMod,{BType, Bucket},?KEY,riakc_gset, [<<"DANG">>,<<"Z">>,<<"Z^2">>]).
323+
check_value(Client,CMod,{BType, Bucket},?KEY,riakc_hll,3).
358324

359325

360326
check_4({BType, counter}, Bucket, Client, CMod) ->
@@ -387,17 +353,8 @@ check_4({BType, hll}, Bucket, Client, CMod) ->
387353
?KEY,
388354
riakc_hll,
389355
4,
390-
[{pr, 3}, {notfound_ok, false}]);
391-
check_4({BType, gset}, Bucket, Client, CMod) ->
392-
lager:info("check_4: Checking final merged value of sset"),
393-
check_value(Client,
394-
CMod, {BType, Bucket},
395-
?KEY,
396-
riakc_gset,
397-
[<<"DANG">>,<<"Z">>,<<"Z^2">>,<<"Zedd's Dead">>],
398356
[{pr, 3}, {notfound_ok, false}]).
399357

400-
401358
check_value(Client, CMod, Bucket, Key, DTMod, Expected) ->
402359
check_value(Client,CMod,Bucket,Key,DTMod,Expected,
403360
[{r,2}, {notfound_ok, true}, {timeout, 5000}]).

0 commit comments

Comments
 (0)