providers/virtualbox: network config uses proper format, tests [GH-2854]

This commit is contained in:
Mitchell Hashimoto 2014-01-17 09:53:02 -08:00
parent 5bc96ad4bf
commit dd33a26422
4 changed files with 27 additions and 3 deletions

View File

@ -71,6 +71,8 @@ BUG FIXES:
- providers/virtualbox: Make more internal interactions with VBoxManage
retryable to avoid spurious VirtualBox errors. [GH-2831]
- providers/virtualbox: Config validation catches invalid keys. [GH-2843]
- providers/virtualbox: Fix network adapter configuration issue if using
provider-specific config. [GH-2854]
- provisioners/chef: When chowning folders, don't follow symlinks.
- provisioners/docker: Only add SSH user to docker group if the user
isn't already in it. [GH-2838]

View File

@ -72,8 +72,8 @@ module VagrantPlugins
#
# @param [Integer] slot The slot for this network adapter.
# @param [Symbol] type The type of adapter.
def network_adapter(slot, type, *args)
@network_adapters[slot] = [type, args]
def network_adapter(slot, type, **opts)
@network_adapters[slot] = [type, opts]
end
# Shortcut for setting memory size for the virtual machine.

View File

@ -0,0 +1,23 @@
require_relative "../../../base"
require Vagrant.source_root.join("plugins/providers/virtualbox/config")
describe VagrantPlugins::ProviderVirtualBox::Config do
context "defaults" do
before { subject.finalize! }
it "should have one NAT adapter" do
expect(subject.network_adapters).to eql({
1 => [:nat, {}],
})
end
end
describe "#network_adapter" do
it "configures additional adapters" do
subject.network_adapter(2, :bridged, auto_config: true)
expect(subject.network_adapters[2]).to eql(
[:bridged, auto_config: true])
end
end
end

View File

@ -3,7 +3,6 @@ require Vagrant.source_root.join("test/unit/base")
require Vagrant.source_root.join("plugins/providers/virtualbox/synced_folder")
# TODO(mitchellh): tag with v2
describe VagrantPlugins::ProviderVirtualBox::SyncedFolder do
let(:machine) do
double("machine").tap do |m|