From 97e534b1e7b8784887e6e02b5b4847a5f697bc33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <45594031+dcermak@users.noreply.github.com> Date: Thu, 2 Dec 2021 17:16:44 +0100 Subject: [PATCH] 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. --- spec/unit/action/prepare_nfs_settings_spec.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/unit/action/prepare_nfs_settings_spec.rb b/spec/unit/action/prepare_nfs_settings_spec.rb index e3ab7a9..f668432 100644 --- a/spec/unit/action/prepare_nfs_settings_spec.rb +++ b/spec/unit/action/prepare_nfs_settings_spec.rb @@ -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