Add loggers to acceptance tests

This commit is contained in:
Mitchell Hashimoto 2011-11-03 23:07:51 -07:00
parent 9a551837d6
commit 08daf11580
2 changed files with 6 additions and 0 deletions

View File

@ -47,6 +47,10 @@ class AcceptanceTest < Test::Unit::TestCase
# variables to pass in.
apps = { "vagrant" => config.vagrant_path }
@environment = Acceptance::IsolatedEnvironment.new(apps, config.env)
# Setup a logger for this test, since tests often log to assist
# with the debugging process in case of failure.
@logger = Log4r::Logger.new("acceptance::#{self.class.name.downcase.gsub("test", "")}")
end
teardown do

View File

@ -67,6 +67,7 @@ class BoxTest < AcceptanceTest
require_box("default")
original_size = File.size(config.boxes["default"])
@logger.debug("Original package size: #{original_size}")
# Add the box, repackage it, and verify that a package.box is
# dumped of relatively similar size.
@ -79,6 +80,7 @@ class BoxTest < AcceptanceTest
# Compare the sizes
repackaged_size = repackaged_file.size
@logger.debug("Repackaged size: #{repackaged_size}")
size_diff = (repackaged_size - original_size).abs
assert(size_diff < 1000, "Sizes should be very similar")
end