Double the UDPSocket in cases where there's no network (#1414)

In PrepareNFSSettings.read_host_ip we use a UDPSocket to connect to the host in
question. However, this fails completely if the system executing the tests has
no network adapters enable, like builders in OBS or Koji. If we double the calls
to this, then we no longer face that issue.
This commit is contained in:
Dan Čermák 2021-12-02 17:16:44 +01:00 committed by GitHub
parent e741871fc4
commit 97e534b1e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,10 +32,14 @@ describe VagrantPlugins::ProviderLibvirt::Action::PrepareNFSSettings do
EOF
end
let(:socket) { double('socket') }
let(:udp_socket) { double('udp_socket') }
before do
allow(::TCPSocket).to receive(:new).and_return(socket)
allow(socket).to receive(:close)
allow(::UDPSocket).to receive(:open).and_return(udp_socket)
allow(udp_socket).to receive(:connect)
end
it 'should retrieve the guest IP address' do