WIP: support partitioned docs
diff --git a/src/fabric/test/eunit/fabric_timeout_test.erl b/src/fabric/test/eunit/fabric_timeout_test.erl index 32b4c35..b300278 100644 --- a/src/fabric/test/eunit/fabric_timeout_test.erl +++ b/src/fabric/test/eunit/fabric_timeout_test.erl
@@ -38,7 +38,7 @@ Ctx = test_util:start_couch([chttpd, fabric]), DbName = ?tempdb(), ok = fabric:create_db(DbName, []), - ok = batch_insert_docs(DbName, 100, 100), + ok = batch_insert_docs(DbName, fun couch_uuids:random/0, 100, 100), ok = stagger_timeouts(), HashedPass = couch_passwords:hash_admin_password(?PASS), ok = config:set("admins", ?ADM, ?b2l(HashedPass), _Persist = false), @@ -68,18 +68,18 @@ ?assert(ExpectLo < Duration andalso Duration < ExpectHi), ok. -batch_insert_docs(DbName, BatchSize, BatchCount) -> +batch_insert_docs(DbName, IdFun, BatchSize, BatchCount) -> lists:foreach( fun(Batch) -> - Docs = [doc(I, Batch) || I <- lists:seq(1, BatchSize)], + Docs = [doc(IdFun(), I, Batch) || I <- lists:seq(1, BatchSize)], {ok, _} = fabric:update_docs(DbName, Docs, []) end, lists:seq(1, BatchCount) ). -doc(I, Batch) -> +doc(Id, I, Batch) -> #doc{ - id = couch_uuids:random(), + id = Id, body = {[ {<<"i">>, I}, {<<"b">>, Batch}, @@ -87,6 +87,10 @@ ]} }. +part_id(Partition) -> + Suffix = couch_uuids:random(), + <<Partition/binary, ":", Suffix/binary>>. + stagger_timeouts() -> lists:foreach( fun({Section, Key, Val}) ->