Add public network tests for docker provider
This commit is contained in:
parent
82700d95b3
commit
88a18fe2c5
|
@ -69,6 +69,10 @@ module VagrantPlugins
|
|||
error_key(:network_name_undefined)
|
||||
end
|
||||
|
||||
class NetworkNoInterfaces < DockerError
|
||||
error_key(:network_no_interfaces)
|
||||
end
|
||||
|
||||
class PackageNotSupported < DockerError
|
||||
error_key(:package_not_supported)
|
||||
end
|
||||
|
|
|
@ -252,6 +252,9 @@ en:
|
|||
The Docker provider was unable to configure networking using the
|
||||
provided network name `%{network_name}`. Please ensure the network
|
||||
name is correct and exists, then try again.
|
||||
network_no_interfaces: |-
|
||||
The Docker provider was unable to list any available interfaces to bridge
|
||||
the public network with.
|
||||
network_subnet_invalid: |-
|
||||
The configured network subnet is not valid for the defined network.
|
||||
Please update the network settings and try again.
|
||||
|
|
|
@ -281,6 +281,21 @@ describe VagrantPlugins::DockerProvider::Action::PrepareNetworks do
|
|||
end
|
||||
|
||||
describe "#process_public_network" do
|
||||
let(:options) { {:ip=>"172.30.130.2", :subnet=>"172.30.0.0/16", :driver=>"bridge", :id=>"30e017d5-488f-5a2f-a3ke-k8dce8246b60"} }
|
||||
|
||||
it "raises an error if there are no network interfaces" do
|
||||
expect(subject).to receive(:list_interfaces).and_return([])
|
||||
|
||||
expect{subject.process_public_network(options, {}, env)}.
|
||||
to raise_error(VagrantPlugins::DockerProvider::Errors::NetworkNoInterfaces)
|
||||
end
|
||||
|
||||
it "generates a network name and configuration" do
|
||||
allow(machine.ui).to receive(:ask).and_return("1")
|
||||
|
||||
network_name, network_options = subject.process_public_network(options, {}, env)
|
||||
expect(network_name).to eq("vagrant_network_public")
|
||||
end
|
||||
end
|
||||
|
||||
describe "#request_public_gateway" do
|
||||
|
|
Loading…
Reference in New Issue