mirror of
https://github.com/valitydev/riak_test.git
synced 2024-11-06 08:35:22 +00:00
Relaxed the capability check to make it a subset check.
This commit is contained in:
parent
aa4ab8405f
commit
742cbc24b9
17
src/rt.erl
17
src/rt.erl
@ -853,22 +853,35 @@ capability(Node, Capability, Default) ->
|
||||
wait_until_capability(Node, Capability, Value) ->
|
||||
rt:wait_until(Node,
|
||||
fun(_) ->
|
||||
cap_equal(Value, capability(Node, Capability))
|
||||
Cap = capability(Node, Capability),
|
||||
lager:info("Capability on node ~p is ~p~n",[Node, Cap]),
|
||||
cap_equal(Value, Cap)
|
||||
end).
|
||||
|
||||
wait_until_capability(Node, Capability, Value, Default) ->
|
||||
rt:wait_until(Node,
|
||||
fun(_) ->
|
||||
Cap = capability(Node, Capability, Default),
|
||||
io:format("capability is ~p ~p",[Node, Cap]),
|
||||
lager:info("Capability on node ~p is ~p~n",[Node, Cap]),
|
||||
cap_equal(Value, Cap)
|
||||
end).
|
||||
|
||||
wait_until_capability_contains(Node, Capability, Value) ->
|
||||
rt:wait_until(Node,
|
||||
fun(_) ->
|
||||
Cap = capability(Node, Capability),
|
||||
lager:info("Capability on node ~p is ~p~n",[Node, Cap]),
|
||||
cap_subset(Value, Cap)
|
||||
end).
|
||||
|
||||
cap_equal(Val, Cap) when is_list(Cap) ->
|
||||
lists:sort(Cap) == lists:sort(Val);
|
||||
cap_equal(Val, Cap) ->
|
||||
Val == Cap.
|
||||
|
||||
cap_subset(Val, Cap) when is_list(Cap) ->
|
||||
sets:is_subset(sets:from_list(Val), sets:from_list(Cap)).
|
||||
|
||||
wait_until_owners_according_to(Node, Nodes) ->
|
||||
SortedNodes = lists:usort(Nodes),
|
||||
F = fun(N) ->
|
||||
|
@ -40,7 +40,7 @@ confirm() ->
|
||||
%% Get put on all nodes
|
||||
Config = [],
|
||||
[Legacy, Previous] = Nodes = rt:build_cluster([{legacy, Config}, {previous, Config}]),
|
||||
?assertEqual(ok, rt:wait_until_capability(Previous, {riak_kv, crdt}, [pncounter])),
|
||||
?assertEqual(ok, rt:wait_until_capability_contains(Previous, {riak_kv, crdt}, [pncounter])),
|
||||
verify_counter_converge:set_allow_mult_true(Nodes),
|
||||
|
||||
{LegacyPB, LegacyHttp} = get_clients(Legacy),
|
||||
@ -63,7 +63,7 @@ confirm() ->
|
||||
|
||||
PrevPB2 = rt:pbc(Legacy),
|
||||
|
||||
?assertEqual(ok, rt:wait_until_capability(Previous, {riak_kv, crdt}, [pncounter,riak_dt_pncounter,riak_dt_orswot,riak_dt_map])),
|
||||
?assertEqual(ok, rt:wait_until_capability_contains(Previous, {riak_kv, crdt}, [pncounter,riak_dt_pncounter,riak_dt_orswot,riak_dt_map])),
|
||||
|
||||
?assertMatch(ok, rhc:counter_incr(LegacyHttp, ?BUCKET, ?KEY, 1)),
|
||||
?assertMatch({ok, 5}, rhc:counter_val(LegacyHttp, ?BUCKET, ?KEY)),
|
||||
|
@ -39,7 +39,7 @@ confirm() ->
|
||||
%% Get put on all nodes
|
||||
Config = [],
|
||||
[Previous, Current]=Nodes = rt:build_cluster([{previous, Config}, {current, Config}]),
|
||||
?assertEqual(ok, rt:wait_until_capability(Current, {riak_kv, crdt}, [pncounter,riak_dt_pncounter,riak_dt_orswot,riak_dt_map])),
|
||||
?assertEqual(ok, rt:wait_until_capability_contains(Current, {riak_kv, crdt}, [pncounter])),
|
||||
|
||||
verify_counter_converge:set_allow_mult_true(Nodes),
|
||||
|
||||
@ -61,7 +61,7 @@ confirm() ->
|
||||
|
||||
rt:upgrade(Previous, current),
|
||||
lager:info("Upgrayded!!"),
|
||||
?assertEqual(ok, rt:wait_until_capability(Current, {riak_kv, crdt}, [riak_dt_pncounter, riak_dt_orswot, riak_dt_map, pncounter])),
|
||||
?assertEqual(ok, rt:wait_until_capability_contains(Current, {riak_kv, crdt}, [riak_dt_pncounter, riak_dt_orswot, riak_dt_map, pncounter])),
|
||||
|
||||
?assertMatch(ok, rhc:counter_incr(PrevHttp, ?BUCKET, ?KEY, 1)),
|
||||
?assertMatch({ok, 5}, rhc:counter_val(PrevHttp, ?BUCKET, ?KEY)),
|
||||
|
Loading…
Reference in New Issue
Block a user