Skip to content

Commit 4eb781a

Browse files
committed
WIP: support partitioned docs
1 parent 8f5408e commit 4eb781a

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

src/fabric/test/eunit/fabric_timeout_test.erl

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ setup() ->
3838
Ctx = test_util:start_couch([chttpd, fabric]),
3939
DbName = ?tempdb(),
4040
ok = fabric:create_db(DbName, []),
41-
ok = batch_insert_docs(DbName, 100, 100),
41+
ok = batch_insert_docs(DbName, fun couch_uuids:random/0, 100, 100),
4242
ok = stagger_timeouts(),
4343
HashedPass = couch_passwords:hash_admin_password(?PASS),
4444
ok = config:set("admins", ?ADM, ?b2l(HashedPass), _Persist = false),
@@ -68,25 +68,29 @@ t_find_no_index({_, DbName}) ->
6868
?assert(ExpectLo < Duration andalso Duration < ExpectHi),
6969
ok.
7070

71-
batch_insert_docs(DbName, BatchSize, BatchCount) ->
71+
batch_insert_docs(DbName, IdFun, BatchSize, BatchCount) ->
7272
lists:foreach(
7373
fun(Batch) ->
74-
Docs = [doc(I, Batch) || I <- lists:seq(1, BatchSize)],
74+
Docs = [doc(IdFun(), I, Batch) || I <- lists:seq(1, BatchSize)],
7575
{ok, _} = fabric:update_docs(DbName, Docs, [])
7676
end,
7777
lists:seq(1, BatchCount)
7878
).
7979

80-
doc(I, Batch) ->
80+
doc(Id, I, Batch) ->
8181
#doc{
82-
id = couch_uuids:random(),
82+
id = Id,
8383
body = {[
8484
{<<"i">>, I},
8585
{<<"b">>, Batch},
8686
{<<"x">>, <<"aaaaaaaaaaab">>}
8787
]}
8888
}.
8989

90+
part_id(Partition) ->
91+
Suffix = couch_uuids:random(),
92+
<<Partition/binary, ":", Suffix/binary>>.
93+
9094
stagger_timeouts() ->
9195
lists:foreach(
9296
fun({Section, Key, Val}) ->

0 commit comments

Comments
 (0)