jaydoane commented on code in PR #5327: URL: https://github.com/apache/couchdb/pull/5327#discussion_r1821788188
########## src/couch_quickjs/test/couch_quickjs_tests.erl: ########## @@ -60,9 +63,55 @@ t_bad_memory_limit(_) -> ?assertEqual(ExpectCmd, string:find(Cmd, ExpectCmd)), ?assertEqual(1, os_cmd(Cmd ++ " -V")). +t_couch_jsengine_config_triggers_proc_server_reload(_) -> + case couch_server:with_spidermonkey() of + false -> + % Spidermonkey is not in the build at all, skip the test + ok; + true -> + OldVal = get_proc_manager_default_js(), + % In the test, set the engine to whatever is not the default + Toggle = + case couch_server:get_js_engine() of + <<"quickjs">> -> "spidermonkey"; + <<"spidermonkey">> -> "quickjs" + end, + + config:set("couchdb", "js_engine", Toggle, false), + % couch_server:get_js_engine/0 should be visible immediately + ?assertEqual(list_to_binary(Toggle), couch_server:get_js_engine()), + + wait_until_proc_manager_updates(OldVal), + ?assertNotEqual(OldVal, get_proc_manager_default_js()), + NewVal = get_proc_manager_default_js(), + + % Toggle back to the original default (test config:delete/3) Review Comment: ```suggestion % Toggle back to the original default ``` ########## src/couch_quickjs/test/couch_quickjs_tests.erl: ########## @@ -60,9 +63,55 @@ t_bad_memory_limit(_) -> ?assertEqual(ExpectCmd, string:find(Cmd, ExpectCmd)), ?assertEqual(1, os_cmd(Cmd ++ " -V")). +t_couch_jsengine_config_triggers_proc_server_reload(_) -> + case couch_server:with_spidermonkey() of + false -> + % Spidermonkey is not in the build at all, skip the test + ok; + true -> + OldVal = get_proc_manager_default_js(), + % In the test, set the engine to whatever is not the default + Toggle = + case couch_server:get_js_engine() of + <<"quickjs">> -> "spidermonkey"; + <<"spidermonkey">> -> "quickjs" + end, + + config:set("couchdb", "js_engine", Toggle, false), + % couch_server:get_js_engine/0 should be visible immediately + ?assertEqual(list_to_binary(Toggle), couch_server:get_js_engine()), + + wait_until_proc_manager_updates(OldVal), + ?assertNotEqual(OldVal, get_proc_manager_default_js()), + NewVal = get_proc_manager_default_js(), + + % Toggle back to the original default (test config:delete/3) Review Comment: Not sure if you want to leave that in? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@couchdb.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org