mirror of
https://github.com/valitydev/riak_test.git
synced 2024-11-06 16:45:29 +00:00
Update based on feedback from Fred
* Use `[binary()]` instead of `list()` in spec for `gen_keys/1`. * Handle case of empty set of results in `assert_search/6`.
This commit is contained in:
parent
49d5c361c5
commit
146e448b8c
@ -59,7 +59,7 @@ host_entries(ClusterConnInfo) ->
|
||||
[riak_http(I) || {_,I} <- ClusterConnInfo].
|
||||
|
||||
%% @doc Generate `SeqMax' keys. Yokozuna supports only UTF-8 compatible keys.
|
||||
-spec gen_keys(pos_integer()) -> list().
|
||||
-spec gen_keys(pos_integer()) -> [binary()].
|
||||
gen_keys(SeqMax) ->
|
||||
[<<N:64/integer>> || N <- lists:seq(1, SeqMax),
|
||||
not lists:any(
|
||||
@ -278,12 +278,16 @@ assert_search(Pid, Cluster, Index, Search, SearchExpect, Params) ->
|
||||
F = fun(_) ->
|
||||
lager:info("Searching ~p and asserting it exists",
|
||||
[SearchExpect]),
|
||||
{ok,{search_results,[{_Index,Fields}], _Score, Found}} =
|
||||
riakc_pb_socket:search(Pid, Index, Search, Params),
|
||||
?assert(lists:member(SearchExpect, Fields)),
|
||||
case Found of
|
||||
1 -> true;
|
||||
0 -> false
|
||||
case riakc_pb_socket:search(Pid, Index, Search, Params) of
|
||||
{ok,{search_results,[{_Index,Fields}], _Score, Found}} ->
|
||||
?assert(lists:member(SearchExpect, Fields)),
|
||||
case Found of
|
||||
1 -> true;
|
||||
0 -> false
|
||||
end;
|
||||
{ok, {search_results, [], _Score, 0}} ->
|
||||
lager:info("Search for multivalued_field has not yet yielded data"),
|
||||
false
|
||||
end
|
||||
end,
|
||||
rt:wait_until(Cluster, F).
|
||||
|
Loading…
Reference in New Issue
Block a user