Add test for requesting public ip range for docker network provider
This commit is contained in:
parent
36f2aaf55e
commit
4f80a9e6d5
|
@ -282,6 +282,7 @@ module VagrantPlugins
|
|||
begin
|
||||
range = IPAddr.new(range)
|
||||
if !subnet.include?(range)
|
||||
puts "we in here"
|
||||
env[:ui].warn(I18n.t(
|
||||
"docker_provider.network_bridge_iprange_outofbounds",
|
||||
subnet: network_options[:subnet],
|
||||
|
|
|
@ -322,5 +322,19 @@ describe VagrantPlugins::DockerProvider::Action::PrepareNetworks do
|
|||
end
|
||||
|
||||
describe "#request_public_iprange" do
|
||||
let(:options) { {:ip=>"172.30.130.2", :subnet=>"172.30.0.0/16", :driver=>"bridge", :id=>"30e017d5-488f-5a2f-a3ke-k8dce8246b60"} }
|
||||
let(:ipaddr) { double("ipaddr", to_s: "172.30.100.2", prefix: 22, succ: "172.30.100.3",
|
||||
ipv6?: false) }
|
||||
let(:subnet) { double("ipaddr", to_s: "172.30.130.2", prefix: 22, succ: "172.30.130.3",
|
||||
ipv6?: false) }
|
||||
|
||||
it "requests a public ip range" do
|
||||
allow(IPAddr).to receive(:new).with(options[:subnet]).and_return(subnet)
|
||||
allow(IPAddr).to receive(:new).with("172.30.130.2").and_return(ipaddr)
|
||||
allow(subnet).to receive(:include?).and_return(true)
|
||||
allow(machine.ui).to receive(:ask).and_return(options[:ip])
|
||||
|
||||
addr = subject.request_public_iprange(options, "bridge", env)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue