Previously, we required a host-only interface with a static IP for NFS to work in VirtualBox, because we needed access to the guest's IP in order to properly configure mount commands. After boot, VirtualBox exposes the IP addresses of a guest's network adapters via the "guestproperty" interface. This adds support for reading VirtualBox guest properties to the VirtualBox driver and utilizes that support to prepare NFS settings, which removes the necessity for a static IP for NFS to work. In this commit we also start building out scaffolding for unit testing vbox actions and drivers. Test plan: - Prepare a Vagrantfile with the following: * private network with type: :dhcp * synced folder with nfs: true - Boot a VM from this Vagrantfile using the virtualbox provider - Machine should boot successfully with working synced folder
30 lines
755 B
Ruby
30 lines
755 B
Ruby
require "rubygems"
|
|
require "rspec/autorun"
|
|
|
|
# Require Vagrant itself so we can reference the proper
|
|
# classes to test.
|
|
require "vagrant"
|
|
|
|
# Add the test directory to the load path
|
|
$:.unshift File.expand_path("../../", __FILE__)
|
|
|
|
# Load in helpers
|
|
require "support/tempdir"
|
|
require "unit/support/dummy_communicator"
|
|
require "unit/support/dummy_provider"
|
|
require "unit/support/shared/base_context"
|
|
require "unit/support/shared/virtualbox_context"
|
|
|
|
# Do not buffer output
|
|
$stdout.sync = true
|
|
$stderr.sync = true
|
|
|
|
# Configure RSpec
|
|
RSpec.configure do |c|
|
|
c.expect_with :rspec, :stdlib
|
|
end
|
|
|
|
# Configure VAGRANT_CWD so that the tests never find an actual
|
|
# Vagrantfile anywhere, or at least this minimizes those chances.
|
|
ENV["VAGRANT_CWD"] = Tempdir.new.path
|