You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2021/10/27 04:37:09 UTC
[couchdb] 03/03: Use unique ddoc id to prevent collisions
This is an automated email from the ASF dual-hosted git repository.
jaydoane pushed a commit to branch mem3-test-fixes
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit a84d0bcb749bad0be17f9e7babe5edfe1380d3e8
Author: Jay Doane <ja...@apache.org>
AuthorDate: Tue Oct 26 21:24:34 2021 -0700
Use unique ddoc id to prevent collisions
Prevent failures like this from repeated test runs:
m 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:<<"">>
---
src/mem3/test/eunit/mem3_bdu_test.erl | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/mem3/test/eunit/mem3_bdu_test.erl b/src/mem3/test/eunit/mem3_bdu_test.erl
index 27d5783..c5464cb 100644
--- a/src/mem3/test/eunit/mem3_bdu_test.erl
+++ b/src/mem3/test/eunit/mem3_bdu_test.erl
@@ -201,12 +201,15 @@ 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),
+ ?debugVal(DDocId),
+ 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
},