nickva commented on code in PR #4813:
URL: https://github.com/apache/couchdb/pull/4813#discussion_r1406510649
##########
src/config/test/config_tests.erl:
##########
@@ -115,6 +111,41 @@ handle_config_terminate(Self, Reason, {Pid, State}) ->
Pid ! {config_msg, {Self, Reason, State}},
ok.
+setup_ini(IniFiles) ->
+ Chain = [write_ini(F) || F <- IniFiles],
+ {Chain, setup(Chain)}.
+
+teardown_ini(_, {Chain, Apps}) ->
+ lists:foreach(
+ fun(Path) -> ok = file:delete(Path) end,
+ Chain
+ ),
+ teardown(Apps).
+
+write_ini(FileName) ->
+ Path = filename:join([?TEMPDIR, FileName]),
+ Data = io_lib:format("[section]\nfile = ~s\n", [FileName]),
+ ok = file:write_file(Path, Data),
+ Path.
+
+config_delete_reload_restart_test_() ->
+ {
+ "Test consistency after set, delete, reload, and restart",
+ foreachx,
+ fun setup_ini/1,
+ fun teardown_ini/2,
+ [
+ {
+ ["default.ini", "local.ini"],
+ fun non_persistent_set_delete_reload_restart/2
Review Comment:
For one or two extra parameters, the complexity of a foreachx might not be
worth it? For the two options just having two test setups: `setup_local_ini`
and `setup_default_ini` and they can call the same setup `setup_ini/1` utility
function could be simpler and could use the standard `?TDEF_FE` macro?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]