Merge remote branch 'github/pr/18'
This closes #18
Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
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 @@
?_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 @@
?_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 @@
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 @@
ok
end.
+wait_update(Ctx) ->
+ case get(Ctx, is_called) of
+ error ->
+ timer:sleep(100),
+ wait_update(Ctx);
+ _ -> ok
+ end.
+
%% ------------
%% State tracer