Check round trip and capability for counters / crdts

This commit is contained in:
Russell Brown 2013-10-21 11:52:50 +01:00
parent 94bcb1569d
commit 894c17415a

View File

@ -73,7 +73,16 @@ confirm() ->
?assertEqual({ok, 7}, riakc_pb_socket:counter_val(PrevPB, ?BUCKET, ?KEY)), ?assertEqual({ok, 7}, riakc_pb_socket:counter_val(PrevPB, ?BUCKET, ?KEY)),
?assertEqual(ok, riakc_pb_socket:counter_incr(PB, ?BUCKET, ?KEY, 1)), ?assertEqual(ok, riakc_pb_socket:counter_incr(PB, ?BUCKET, ?KEY, 1)),
?assertEqual({ok, 8}, riakc_pb_socket:counter_val(PB, ?BUCKET, ?KEY)), ?assertEqual({ok, 8}, riakc_pb_socket:counter_val(PB, ?BUCKET, ?KEY)),
%% And check that those 1.4 written values can be accessed / incremented over the 2.0 API
?assertEqual({ok, {counter, 8, 0}}, riakc_pb_socket:fetch_type(PrevPB, {<<"default">>, ?BUCKET}, ?KEY)),
?assertEqual(ok, riakc_pb_socket:update_type(PrevPB, {<<"default">>, ?BUCKET}, ?KEY, gen_counter_op())),
?assertEqual({ok, 9}, riakc_pb_socket:counter_val(PB, ?BUCKET, ?KEY)),
pass. pass.
gen_counter_op() ->
riakc_counter:to_op(riakc_counter:increment(riakc_counter:new())).
get_clients(Node) -> get_clients(Node) ->
{rt:pbc(Node), rt:httpc(Node)}. {rt:pbc(Node), rt:httpc(Node)}.