iilyak commented on code in PR #4483:
URL: https://github.com/apache/couchdb/pull/4483#discussion_r1163036952


##########
src/couch_log/test/eunit/couch_log_formatter_test.erl:
##########
@@ -25,6 +25,22 @@ truncate_test() ->
     Entry = couch_log_formatter:format(info, self(), Msg),
     ?assert(length(Entry#log_entry.msg) =< 16000).
 
+format_report_etoolong_test() ->
+    Payload = lists:flatten(["a" || _ <- lists:seq(1, 1048576)]),
+    Resp = couch_log_formatter:format_report(self(), report123, #{
+        msg => Payload
+    }),
+    ?assertEqual({error, emsgtoolong}, Resp).
+
+format_report_test() ->
+    {ok, Entry} = couch_log_formatter:format_report(self(), report123, #{
+        foo => 123,
+        bar => "barStr",
+        baz => baz
+    }),
+    Formatted = "[foo=\"123\" baz=\"baz\" bar=\"barStr\"]",

Review Comment:
   The expectation of a stable order of keys might not hold in future versions 
of OTP. The documentation for `maps:fold` used in `format_meta` states:
   
   > Calls F(Key, Value, AccIn) for every Key to value Value association in 
MapOrIter in any order. 
   
   I think we can accept the risk for a test case. However you can decide 
whether you want to handle it.



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