Skip to content

Commit 3c8dce8

Browse files
author
Mark Allen
committed
Return 0 instead of doing another rt:sysread
Previously, wait_until_read function would execute another rt:systest_read call and return a count of errors, when we already asserted above that the list is empty. If the wait_until function does not return true, or times out, or hits the retry limit, the running test ought to fail anyway without needing an additional read to fail. So doing another call is redundant and unnecessary; we just return 0 as the value if rt:wait_until completes successfully.
1 parent 8a6ba3f commit 3c8dce8

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tests/repl_util.erl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,17 @@ wait_until_fullsync_stopped(SourceLeader) ->
195195
end).
196196

197197
wait_for_reads(Node, Start, End, Bucket, R) ->
198-
rt:wait_until(Node,
198+
ok = rt:wait_until(Node,
199199
fun(_) ->
200200
Reads = rt:systest_read(Node, Start, End, Bucket, R, <<>>, true),
201201
Reads == []
202202
end),
203-
Reads = rt:systest_read(Node, Start, End, Bucket, R, <<>>, true),
204-
lager:info("Reads: ~p", [Reads]),
205-
length(Reads).
203+
%% rt:systest_read/6 returns a list of errors encountered while performing
204+
%% the requested reads. Since we are asserting this list is empty above,
205+
%% we already know that if we reached here, that the list of reads has
206+
%% no errors. Therefore, we simply return 0 and do not execute another
207+
%% systest_read call.
208+
0.
206209

207210
get_fs_coord_status_item(Node, SinkName, ItemName) ->
208211
Status = rpc:call(Node, riak_repl_console, status, [quiet]),

0 commit comments

Comments
 (0)