diff options
author | Jay Doane <jaydoane@apache.org> | 2021-10-26 21:24:34 -0700 |
---|---|---|
committer | Jay Doane <jay.s.doane@gmail.com> | 2021-10-27 11:22:47 -0700 |
commit | 537fd31185142190ff3dc55d707f9d899b455b17 (patch) | |
tree | d50fa98bacce8e44433b12d312ace84a3d3a8a3d | |
parent | 4ea233fb250e465cd36c83a41bb0630af0c08ce9 (diff) | |
download | couchdb-537fd31185142190ff3dc55d707f9d899b455b17.tar.gz |
Use unique ddoc id to prevent collisions
Prevent failures like this from repeated test runs:
mem3_bdu_test:73: mem3_bdu_shard_doc_test_ (t_design_docs_are_not_validated)...*failed*
in function mem3_bdu_test:'-t_design_docs_are_not_validated/1-fun-0-'/1 (test/eunit/mem3_bdu_test.erl, line 206)
in call from mem3_bdu_test:t_design_docs_are_not_validated/1 (test/eunit/mem3_bdu_test.erl, line 206)
in call from eunit_test:run_testfun/1 (eunit_test.erl, line 71)
in call from eunit_proc:run_test/1 (eunit_proc.erl, line 510)
in call from eunit_proc:with_timeout/3 (eunit_proc.erl, line 335)
in call from eunit_proc:handle_test/2 (eunit_proc.erl, line 493)
in call from eunit_proc:tests_inorder/3 (eunit_proc.erl, line 435)
in call from eunit_proc:with_timeout/3 (eunit_proc.erl, line 325)
**error:{assertEqual,[{module,mem3_bdu_test},
{line,206},
{expression,"Code"},
{expected,201},
{value,409}]}
output:<<"">>
-rw-r--r-- | src/mem3/test/eunit/mem3_bdu_test.erl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mem3/test/eunit/mem3_bdu_test.erl b/src/mem3/test/eunit/mem3_bdu_test.erl index 27d578339..ad047f6e9 100644 --- a/src/mem3/test/eunit/mem3_bdu_test.erl +++ b/src/mem3/test/eunit/mem3_bdu_test.erl @@ -201,12 +201,14 @@ t_by_range_val_not_array({Top, Db, ShardsDb}) -> t_design_docs_are_not_validated({Top, _, ShardsDb}) -> - DDoc = #{<<"_id">> => <<"_design/ddoc_bdu_test">>}, + Suffix = integer_to_list(erlang:system_time() + rand:uniform(1000)), + DDocId = list_to_binary("_design/ddoc_bdu_test-" ++ Suffix), + DDoc = #{<<"_id">> => DDocId}, {Code, Res} = req(post, Top ++ ShardsDb, DDoc), ?assertEqual(201, Code), #{<<"rev">> := Rev} = Res, Deleted = #{ - <<"id">> => <<"_design/ddoc_bdu_test">>, + <<"id">> => DDocId, <<"_rev">> => Rev, <<"_deleted">> => true }, |