couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iil...@apache.org
Subject [1/2] couchdb-couch-epi git commit: Don't rely on timer:sleep after update in tests
Date Wed, 23 Mar 2016 13:32:44 GMT
Repository: couchdb-couch-epi
Updated Branches:
  refs/heads/master de32c6554 -> 5a7f2868c


Don't rely on timer:sleep after update in tests

To fix currently broken build we do not use timer:sleep/1 after update/2.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-epi/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-epi/commit/6fe3b2a3
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-epi/tree/6fe3b2a3
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-epi/diff/6fe3b2a3

Branch: refs/heads/master
Commit: 6fe3b2a3d80dd6ab4a667ddb02f2f5833a4eda64
Parents: de32c65
Author: ILYA Khlopotov <iilyak@ca.ibm.com>
Authored: Tue Mar 22 16:47:33 2016 -0700
Committer: ILYA Khlopotov <iilyak@ca.ibm.com>
Committed: Tue Mar 22 16:47:33 2016 -0700

----------------------------------------------------------------------
 test/couch_epi_tests.erl | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-epi/blob/6fe3b2a3/test/couch_epi_tests.erl
----------------------------------------------------------------------
diff --git a/test/couch_epi_tests.erl b/test/couch_epi_tests.erl
index 56733b1..bde85a8 100644
--- a/test/couch_epi_tests.erl
+++ b/test/couch_epi_tests.erl
@@ -364,7 +364,6 @@ ensure_notified_when_changed(functions, #ctx{key = Key} = Ctx) ->
     ?_test(begin
         subscribe(Ctx, test_app, Key),
         update(functions, Ctx),
-        timer:sleep(200),
         Result = get(Ctx, is_called),
         ExpectedDefs = [
             {provider1,[{inc,2},{fail,2}]},
@@ -377,7 +376,6 @@ ensure_notified_when_changed(Case, #ctx{key = Key} = Ctx) ->
     ?_test(begin
         subscribe(Ctx, test_app, Key),
         update(Case, Ctx),
-        timer:sleep(200),
         ExpectedData = lists:usort([
             {[complex, key, 1], [{type, counter}, {desc, updated_foo}]},
             {[complex, key, 2], [{type, counter}, {desc, bar}]}
@@ -560,7 +558,8 @@ generate_module(Name, Body) ->
 
 update(Case, #ctx{pid = Pid, modules = Modules} = Ctx) ->
     update_definitions(Case, Ctx),
-    upgrade_release(Pid, Modules).
+    upgrade_release(Pid, Modules),
+    wait_update(Ctx).
 
 update_definitions(data_file, #ctx{file = File}) ->
     {ok, _} = file:copy(?DATA_FILE2, File),
@@ -582,6 +581,14 @@ maybe_wait(Opts) ->
             ok
     end.
 
+wait_update(Ctx) ->
+    case get(Ctx, is_called) of
+        error ->
+            timer:sleep(100),
+            wait_update(Ctx);
+        _ -> ok
+    end.
+
 %% ------------
 %% State tracer
 


Mime
View raw message