VMs have their own loggers
This commit is contained in:
parent
fa9bdad175
commit
a1794dca80
|
@ -4,6 +4,7 @@ module Vagrant
|
||||||
|
|
||||||
attr_reader :env
|
attr_reader :env
|
||||||
attr_reader :system
|
attr_reader :system
|
||||||
|
attr_reader :logger
|
||||||
attr_reader :name
|
attr_reader :name
|
||||||
attr_accessor :vm
|
attr_accessor :vm
|
||||||
|
|
||||||
|
@ -42,6 +43,8 @@ module Vagrant
|
||||||
# Load the associated system.
|
# Load the associated system.
|
||||||
load_system!
|
load_system!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@logger = ResourceLogger.new(@name, @env)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Loads the system associated with the VM. The system class is
|
# Loads the system associated with the VM. The system class is
|
||||||
|
|
|
@ -37,7 +37,8 @@ class VMTest < Test::Unit::TestCase
|
||||||
|
|
||||||
context "vagrant VM instance" do
|
context "vagrant VM instance" do
|
||||||
setup do
|
setup do
|
||||||
@vm = Vagrant::VM.new(:env => @env, :vm => @mock_vm)
|
@vm_name = "foo"
|
||||||
|
@vm = Vagrant::VM.new(:env => @env, :vm => @mock_vm, :vm_name => @vm_name)
|
||||||
@mock_vm.stubs(:uuid).returns("foo")
|
@mock_vm.stubs(:uuid).returns("foo")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -53,6 +54,16 @@ class VMTest < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "the logger" do
|
||||||
|
should "create a logger for the proper environment" do
|
||||||
|
logger = @vm.logger
|
||||||
|
assert logger
|
||||||
|
assert logger.is_a?(Vagrant::ResourceLogger)
|
||||||
|
assert_equal @vm.env, logger.env
|
||||||
|
assert_equal @vm_name, logger.resource
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "accessing the SSH object" do
|
context "accessing the SSH object" do
|
||||||
setup do
|
setup do
|
||||||
# Reset this to nil to force the reload
|
# Reset this to nil to force the reload
|
||||||
|
|
Loading…
Reference in New Issue