You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ko...@apache.org on 2019/08/18 22:56:49 UTC

[couchdb] 03/03: Refactor test to keep setup/teardown out of timer

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

kocolosk pushed a commit to branch jenkins-elixir-retry-until-flakes
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 42efd5a10f2457756a31859d77db7fd9282271e0
Author: Adam Kocoloski <ko...@apache.org>
AuthorDate: Sun Aug 18 09:33:25 2019 -0400

    Refactor test to keep setup/teardown out of timer
---
 src/ddoc_cache/test/eunit/ddoc_cache_lru_test.erl | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/ddoc_cache/test/eunit/ddoc_cache_lru_test.erl b/src/ddoc_cache/test/eunit/ddoc_cache_lru_test.erl
index e37f1c0..9a53915 100644
--- a/src/ddoc_cache/test/eunit/ddoc_cache_lru_test.erl
+++ b/src/ddoc_cache/test/eunit/ddoc_cache_lru_test.erl
@@ -47,14 +47,17 @@ stop_couch(Ctx) ->
 
 check_not_started_test() ->
     % Starting couch, but not ddoc_cache
-    Ctx = test_util:start_couch(),
-    try
-        Key = {ddoc_cache_entry_custom, {<<"dbname">>, ?MODULE}},
-        ?assertEqual({ok, <<"dbname">>}, ddoc_cache_lru:open(Key))
-    after
-        test_util:stop_couch(Ctx)
-    end.
-
+    {
+        setup,
+        fun test_util:start_couch/0,
+        fun test_util:stop_couch/1,
+        [
+            fun(_) ->
+                Key = {ddoc_cache_entry_custom, {<<"dbname">>, ?MODULE}},
+                ?assertEqual({ok, <<"dbname">>}, ddoc_cache_lru:open(Key))
+            end
+        ]
+    }.
 
 check_lru_test_() ->
     {