summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Doane <jaydoane@apache.org>2021-06-01 10:31:32 -0700
committerJay Doane <jay.s.doane@gmail.com>2021-06-02 12:04:07 -0700
commit8abdd1fc61db67ae2856876ebb7c76446c0a450e (patch)
tree2d81ec8d32f5d89dfc76f079d23695a181844d65
parent90b230e7f47a3368452daa4f51bd8858c9ccdd00 (diff)
downloadcouchdb-8abdd1fc61db67ae2856876ebb7c76446c0a450e.tar.gz
Improve stability of couch_js_proc_manager_tests
-rw-r--r--src/couch_js/test/couch_js_proc_manager_tests.erl24
1 files changed, 7 insertions, 17 deletions
diff --git a/src/couch_js/test/couch_js_proc_manager_tests.erl b/src/couch_js/test/couch_js_proc_manager_tests.erl
index f138dd651..5a791f8ad 100644
--- a/src/couch_js/test/couch_js_proc_manager_tests.erl
+++ b/src/couch_js/test/couch_js_proc_manager_tests.erl
@@ -19,7 +19,7 @@
-define(TDEF(A), {atom_to_list(A), fun A/0}).
-define(NUM_PROCS, 3).
--define(TIMEOUT, 1000).
+-define(TIMEOUT, 2000).
-define(TIMEOUT_ERROR(Msg), erlang:error({assertion_failed, [
{module, ?MODULE},
@@ -35,7 +35,12 @@ start() ->
config:set("query_server_config", "os_process_limit", "3", false),
config:set("query_server_config", "os_process_soft_limit", "2", false),
config:set("query_server_config", "os_process_idle_limit", "1", false),
- ok = config_wait("os_process_idle_limit", "1"),
+ ok = test_util:wait(fun() ->
+ case config:get("query_server_config", "os_process_idle_limit") of
+ "1" -> ok;
+ _ -> wait
+ end
+ end, ?TIMEOUT, 10),
Started.
@@ -356,18 +361,3 @@ kill_client({Pid, Ref}) ->
after ?TIMEOUT ->
?TIMEOUT_ERROR("Timeout waiting for killed client 'DOWN'")
end.
-
-
-config_wait(Key, Value) ->
- config_wait(Key, Value, 0).
-
-config_wait(Key, Value, Count) ->
- case config:get("query_server_config", Key) of
- Value ->
- ok;
- _ when Count > 10 ->
- ?TIMEOUT_ERROR("Error waiting for config changes.");
- _ ->
- timer:sleep(10),
- config_wait(Key, Value, Count + 1)
- end.