Test mistake

If random integer was low, total could be below threshold - so calculate total correctly.

Should make value re-generate random uniform, but test is still valid without this
This commit is contained in:
Martin Sumner 2018-09-25 18:32:48 +01:00
parent 051fcd672c
commit 0772317247
2 changed files with 19 additions and 1 deletions

View file

@ -163,7 +163,20 @@ small_load_with2i(_Config) ->
{foldobjects_bybucket, ?RIAK_TAG, "Bucket", all, {SumIntFun, 0}, true},
{async, Sum1} = leveled_bookie:book_returnfolder(Bookie1, BucketObjQ),
Total1 = Sum1(),
true = Total1 > 100000,
io:format("Total from summing all I is ~w~n", [Total1]),
SumFromObjLFun =
fun(Obj, Acc) ->
{I, _Bin} = testutil:get_value_from_objectlistitem(Obj),
Acc + I
end,
ObjL1Total =
lists:foldl(SumFromObjLFun, 0, ObjL1),
ChkList1Total =
lists:foldl(SumFromObjLFun, 0, ChkList1),
io:format("Total in original object list ~w and from removed list ~w~n",
[ObjL1Total, ChkList1Total]),
Total1 = ObjL1Total - ChkList1Total,
ok = leveled_bookie:book_close(Bookie1),

View file

@ -50,6 +50,7 @@
foldkeysfun_returnbucket/3,
sync_strategy/0,
riak_object/4,
get_value_from_objectlistitem/1,
numbered_key/1,
fixed_bin_key/1]).
@ -478,6 +479,10 @@ set_object(Bucket, Key, Value, IndexGen, Indexes2Remove) ->
vclock=generate_vclock()},
Spec1}.
get_value_from_objectlistitem({_Int, Obj, _Spc}) ->
[Content] = Obj#r_object.contents,
Content#r_content.value.
update_some_objects(Bookie, ObjList, SampleSize) ->
StartWatchA = os:timestamp(),
ToUpdateList = lists:sublist(lists:sort(ObjList), SampleSize),