diff --git a/mylog.log b/mylog.log new file mode 100644 index 000000000..faa41b0c7 --- /dev/null +++ b/mylog.log @@ -0,0 +1 @@ +# Logfile created on 2017-11-21 19:15:42 +0000 by logger.rb/56438 diff --git a/spec/util/vmdb-logger_spec.rb b/spec/util/vmdb-logger_spec.rb index 34ccdae22..8c6ba2c89 100644 --- a/spec/util/vmdb-logger_spec.rb +++ b/spec/util/vmdb-logger_spec.rb @@ -96,8 +96,14 @@ end context "long messages" do + before(:each) do + @logger = VMDBLogger.new(@log) + end + it "truncates long messages when max_message_size is set" do - # TODO Add test body! + msg = "a" * 1_572_864 # 1.5 mb in bytes + _, message = @logger.formatter.call(:error, Time.now.utc, "", msg).split("-- : ") + expect(message.strip.size).to eq((1.megabyte)) end end