Skip to content

Commit

Permalink
Added spec test to check msg is truncated to 1.megabyte
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian Cheal committed Nov 21, 2017
1 parent ad4fb78 commit 7cfac18
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions mylog.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Logfile created on 2017-11-21 19:15:42 +0000 by logger.rb/56438
8 changes: 7 additions & 1 deletion spec/util/vmdb-logger_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 7cfac18

Please sign in to comment.