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 2020/02/21 06:08:17 UTC

[couchdb] 01/01: Improve validate_dbname test

This is an automated email from the ASF dual-hosted git repository.

jaydoane pushed a commit to branch improve-validate-dbname-test
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 2ccde31ef9adfd02ef7c2f303a62bb6ab0a1cc9d
Author: Jay Doane <ja...@apache.org>
AuthorDate: Thu Feb 20 22:06:43 2020 -0800

    Improve validate_dbname test
    
    It's possible for other couch_epi plugins to interfere with this test,
    so mock `couch_epi:decide/5` to always return `no_decision`.
---
 src/fabric/test/fabric2_db_misc_tests.erl | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/fabric/test/fabric2_db_misc_tests.erl b/src/fabric/test/fabric2_db_misc_tests.erl
index c48ee2c..42a63e2 100644
--- a/src/fabric/test/fabric2_db_misc_tests.erl
+++ b/src/fabric/test/fabric2_db_misc_tests.erl
@@ -141,7 +141,15 @@ validate_dbname(_) ->
             Expect = {error, {Reason, DbName}},
             ?assertEqual(Expect, fabric2_db:validate_dbname(DbName))
     end,
-    lists:foreach(CheckFun, Tests).
+    try
+        % Don't allow epi plugins to interfere with test results
+        meck:new(couch_epi, [passthrough]),
+        meck:expect(couch_epi, decide, 5, no_decision),
+        lists:foreach(CheckFun, Tests)
+    after
+        % Unload within the test to minimize interference with other tests
+        meck:unload()
+    end.
 
 
 validate_doc_ids(_) ->