hobo-up persists the UUID of the VM
This commit is contained in:
parent
e948ce9663
commit
3631ff0078
|
@ -1,4 +1,5 @@
|
|||
gembin/*
|
||||
vendor/gems/*
|
||||
pkg/*
|
||||
Hobofile
|
||||
Hobofile
|
||||
.hobo
|
|
@ -10,23 +10,23 @@ module Hobo
|
|||
forward_ssh(vm)
|
||||
setup_shared_folder(vm)
|
||||
end
|
||||
|
||||
|
||||
def import
|
||||
HOBO_LOGGER.info "Importing base VM (#{Hobo.config[:vm][:base]})..."
|
||||
VirtualBox::VM.import(File.expand_path(Hobo.config[:vm][:base]))
|
||||
end
|
||||
|
||||
|
||||
def persist_uuid(vm)
|
||||
HOBO_LOGGER.info "Persisting the VM UUID (#{vm.uuid})..."
|
||||
# TODO: persist it! dot file in the root (where Hobofile is)
|
||||
Env.persist_uuid(vm.uuid)
|
||||
end
|
||||
|
||||
|
||||
def setup_mac_address(vm)
|
||||
HOBO_LOGGER.info "Matching MAC addresses..."
|
||||
vm.nics.first.macaddress = Hobo.config[:vm][:base_mac]
|
||||
vm.save(true)
|
||||
end
|
||||
|
||||
|
||||
def forward_ssh(vm)
|
||||
HOBO_LOGGER.info "Forwarding SSH ports..."
|
||||
port = VirtualBox::ForwardedPort.new
|
||||
|
@ -36,7 +36,7 @@ module Hobo
|
|||
vm.forwarded_ports << port
|
||||
vm.save(true)
|
||||
end
|
||||
|
||||
|
||||
# TODO: We need to get the host path.
|
||||
def setup_shared_folder(vm)
|
||||
HOBO_LOGGER.info "Creating shared folders..."
|
||||
|
|
|
@ -5,7 +5,7 @@ class VMTest < Test::Unit::TestCase
|
|||
@vm = mock("vm")
|
||||
Hobo.config!(hobo_mock_config)
|
||||
end
|
||||
|
||||
|
||||
context "hobo up" do
|
||||
should "create the instance in the proper order" do
|
||||
create_seq = sequence("create_seq")
|
||||
|
@ -17,35 +17,39 @@ class VMTest < Test::Unit::TestCase
|
|||
Hobo::VM.up
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context "importing" do
|
||||
should "call import on VirtualBox::VM with the proper base" do
|
||||
VirtualBox::VM.expects(:import).once
|
||||
Hobo::VM.import
|
||||
end
|
||||
|
||||
|
||||
should "return the VM object" do
|
||||
VirtualBox::VM.expects(:import).returns(@vm).once
|
||||
assert_equal @vm, Hobo::VM.import
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context "persisting UUID" do
|
||||
# TODO, functionality doesn't exist yet
|
||||
should "persist the UUID with Env" do
|
||||
@vm.stubs(:uuid).returns("FOO")
|
||||
Hobo::Env.expects(:persist_uuid).with(@vm.uuid).once
|
||||
Hobo::VM.persist_uuid(@vm)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context "setting up MAC address" do
|
||||
should "match the mac address with the base" do
|
||||
nic = mock("nic")
|
||||
nic.expects(:macaddress=).once
|
||||
|
||||
|
||||
@vm.expects(:nics).returns([nic]).once
|
||||
@vm.expects(:save).with(true).once
|
||||
|
||||
|
||||
Hobo::VM.setup_mac_address(@vm)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context "forwarding SSH" do
|
||||
should "create a port forwarding for the VM" do
|
||||
# TODO: Test the actual port value to make sure it has the
|
||||
|
@ -57,7 +61,7 @@ class VMTest < Test::Unit::TestCase
|
|||
Hobo::VM.forward_ssh(@vm)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context "setting up the shared folder" do
|
||||
# TODO: Since the code actually doesn't do anything yet
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue