File 0002-Double-the-UDPSocket-in-cases-where-there-s-no-netwo.patch of Package vagrant-libvirt
From 940bb9d1f7de30969859dcefd5f373a3fbb4ff69 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 2/3] 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.
(cherry picked from commit 97e534b1e7b8784887e6e02b5b4847a5f697bc33)
---
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
--
2.31.1