Skip to content

Commit 3abcab1

Browse files
sure up results checks in yz_pb
1 parent 463b53d commit 3abcab1

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

riak_test/yz_pb.erl

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,16 @@ confirm_multivalued_field(Cluster) ->
246246
Search = <<"name_ss:turner">>,
247247
{ok, Pid} = riakc_pb_socket:start_link(Host, (Port-1)),
248248
F = fun(_) ->
249-
{ok,{search_results,[{Index,Fields}], _Score, Found}} =
250-
riakc_pb_socket:search(Pid, Index, Search, Params),
249+
case riakc_pb_socket:search(Pid, Index, Search, Params) of
250+
{ok,{search_results,[{Index,Fields}], _Score, Found}} ->
251251
?assert(lists:member({<<"name_ss">>,<<"turner">>}, Fields)),
252252
?assert(lists:member({<<"name_ss">>,<<"hooch">>}, Fields)),
253253
case Found of
254254
1 -> true;
255255
0 -> false
256-
end
256+
end;
257+
_ -> false
258+
end
257259
end,
258260
yz_rt:wait_until(Cluster, F),
259261
riakc_pb_socket:stop(Pid).
@@ -275,13 +277,16 @@ confirm_multivalued_field_json_array(Cluster) ->
275277
Search = <<"groups_s:3304cf79">>,
276278
{ok, Pid} = riakc_pb_socket:start_link(Host, (Port-1)),
277279
F = fun(_) ->
278-
{ok,{search_results,[{Index,Fields}], _Score, Found}} =
279-
riakc_pb_socket:search(Pid, Index, Search, Params),
280-
?assert(lists:member({<<"groups_s">>,<<"3304cf79">>}, Fields)),
280+
case riakc_pb_socket:search(Pid, Index, Search, Params) of
281+
{ok,{search_results,[{Index,Fields}], _Score, Found}} ->
282+
?assert(lists:member({<<"groups_s">>,<<"3304cf79">>},
283+
Fields)),
281284
case Found of
282285
1 -> true;
283286
0 -> false
284-
end
287+
end;
288+
_ -> false
289+
end
285290
end,
286291
yz_rt:wait_until(Cluster, F),
287292
riakc_pb_socket:stop(Pid).
@@ -303,14 +308,17 @@ confirm_multivalued_field_with_high_n_val(Cluster) ->
303308
Search = <<"groups_s:3304cf79">>,
304309
{ok, Pid} = riakc_pb_socket:start_link(Host, (Port-1)),
305310
F = fun(_) ->
306-
{ok,{search_results,[{Index,Fields}], _Score, Found}} =
307-
riakc_pb_socket:search(Pid, Index, Search, Params),
311+
case riakc_pb_socket:search(Pid, Index, Search, Params) of
312+
{ok,{search_results,[{Index,Fields}], _Score, Found}} ->
308313
?assert(lists:member({<<"groups_s">>,<<"3304cf79">>}, Fields)),
309314
?assert(lists:member({<<"groups_s">>,<<"abe155cf">>}, Fields)),
315+
310316
case Found of
311317
1 -> true;
312318
0 -> false
313-
end
319+
end;
320+
_ -> false
321+
end
314322
end,
315323
yz_rt:wait_until(Cluster, F),
316324
riakc_pb_socket:stop(Pid).

0 commit comments

Comments
 (0)