couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vatam...@apache.org
Subject [couchdb] branch master updated: Fix timeouts in couch epi tests
Date Wed, 02 Aug 2017 05:37:41 GMT
This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 408096f  Fix timeouts in couch epi tests
408096f is described below

commit 408096f5537793a057bdcf2a1db01aee9c3f74dd
Author: Nick Vatamaniuc <vatamane@apache.org>
AuthorDate: Tue Aug 1 22:20:11 2017 -0400

    Fix timeouts in couch epi tests
    
    Sleeps there not enough when run in a contrained test environment
    
    Adjust timeouts to let tests pass even when setting CPU usage limit down to
    1% in my VirtualBox VM.
    
    Also switch to using macro defines to make it look slightly cleaner.
    
    Fixes #731
---
 src/couch_epi/test/couch_epi_tests.erl | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/couch_epi/test/couch_epi_tests.erl b/src/couch_epi/test/couch_epi_tests.erl
index bde85a8..99a06f3 100644
--- a/src/couch_epi/test/couch_epi_tests.erl
+++ b/src/couch_epi/test/couch_epi_tests.erl
@@ -22,6 +22,7 @@
 -record(ctx, {file, handle, pid, kv, key, modules = []}).
 
 -define(TIMEOUT, 5000).
+-define(RELOAD_WAIT, 1000).
 
 -define(temp_atom,
     fun() ->
@@ -392,7 +393,7 @@ ensure_notified_when_changed(Case, #ctx{key = Key} = Ctx) ->
 ensure_not_notified_when_no_change(_Case, #ctx{key = Key} = Ctx) ->
     ?_test(begin
         subscribe(Ctx, test_app, Key),
-        timer:sleep(200),
+        timer:sleep(?RELOAD_WAIT),
         ?assertMatch(error, get(Ctx, is_called))
     end).
 
@@ -495,7 +496,7 @@ ensure_reload_if_manually_triggered(Case, #ctx{pid = Pid, key = Key} =
Ctx) ->
         subscribe(Ctx, test_app, Key),
         update_definitions(Case, Ctx),
         couch_epi_module_keeper:reload(Pid),
-        timer:sleep(50),
+        timer:sleep(?RELOAD_WAIT),
         ?assertNotEqual(error, get(Ctx, is_called))
     end).
 
@@ -505,7 +506,7 @@ ensure_reload_if_changed(data_file =  Case,
         Version = Handle:version(),
         subscribe(Ctx, test_app, Key),
         update_definitions(Case, Ctx),
-        timer:sleep(250),
+        timer:sleep(?RELOAD_WAIT),
         ?assertNotEqual(Version, Handle:version()),
         ?assertNotEqual(error, get(Ctx, is_called))
     end);
@@ -516,7 +517,7 @@ ensure_reload_if_changed(Case,
         subscribe(Ctx, test_app, Key),
         update(Case, Ctx),
         ?assertNotEqual(Version, Handle:version()),
-        timer:sleep(100), %% Allow some time for notify to be called
+        timer:sleep(?RELOAD_WAIT), %% Allow some time for notify to be called
         ?assertNotEqual(error, get(Ctx, is_called))
     end).
 
@@ -534,7 +535,7 @@ ensure_no_reload_when_no_change(_Case,
     ?_test(begin
         Version = Handle:version(),
         subscribe(Ctx, test_app, Key),
-        timer:sleep(450),
+        timer:sleep(?RELOAD_WAIT),
         ?assertEqual(Version, Handle:version()),
         ?assertEqual(error, get(Ctx, is_called))
     end).
@@ -576,7 +577,7 @@ subscribe(#ctx{kv = Kv}, _App, _Key) ->
 maybe_wait(Opts) ->
     case lists:member(concurrent, Opts) of
         true ->
-            timer:sleep(100);
+            timer:sleep(?RELOAD_WAIT);
         false ->
             ok
     end.
@@ -584,7 +585,7 @@ maybe_wait(Opts) ->
 wait_update(Ctx) ->
     case get(Ctx, is_called) of
         error ->
-            timer:sleep(100),
+            timer:sleep(?RELOAD_WAIT),
             wait_update(Ctx);
         _ -> ok
     end.

-- 
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <commits@couchdb.apache.org>'].

Mime
View raw message