summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Shorin <kxepal@apache.org>2014-04-30 00:11:41 +0400
committerAlexander Shorin <kxepal@apache.org>2014-04-30 00:17:15 +0400
commit3442ec5e82370ca66fbb42b985bc9150eee0b42c (patch)
tree673be676328746ec172e8541d6b4dc454f1b5cd8
parent0bb567f430c12d8686569398b7be91b699d5f9dc (diff)
downloadcouchdb-3442ec5e82370ca66fbb42b985bc9150eee0b42c.tar.gz
Fix race condition in test suite on checking ref count
The issue happened from time to time on CentOS system: one, two or few tests failed because ref count wasn't decremented till the very moment when this value was requested and the result returned back. Adding sleep timeout helps to synchronise calls and while 0.1 sec sleep is good, but not enough - with 0.2 sleep floating errors happens no more.
-rwxr-xr-xtest/etap/200-view-group-no-db-leaks.t1
1 files changed, 1 insertions, 0 deletions
diff --git a/test/etap/200-view-group-no-db-leaks.t b/test/etap/200-view-group-no-db-leaks.t
index b711ac853..9583d0984 100755
--- a/test/etap/200-view-group-no-db-leaks.t
+++ b/test/etap/200-view-group-no-db-leaks.t
@@ -212,6 +212,7 @@ get_db_ref_counter() ->
check_db_ref_count() ->
{ok, #db{fd_ref_counter = Ref} = Db} = couch_db:open_int(test_db_name(), []),
ok = couch_db:close(Db),
+ timer:sleep(200), % sleep a bit to prevent race condition
etap:is(couch_ref_counter:count(Ref), 2,
"DB ref counter is only held by couch_db and couch_db_updater"),
ok.