nickva commented on code in PR #4813:
URL: https://github.com/apache/couchdb/pull/4813#discussion_r1406548807


##########
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:
   Yeah, I think the write to last is pretty obvious. The interesting 
corner-cases are around how the effective value changes after set/delete, with 
persist/non-persist and either restart or reload. So cases like "set value", 
then the same value should persist after restart and reload, or reload then 
restart.
   
   My main beef with `foreachx` is that it becomes another eunit quirk one has 
to learn to be able add add or fix failing tests.



-- 
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]

Reply via email to