Skip to content

Instantly share code, notes, and snippets.

@igalic
Created February 8, 2023 14:22
Show Gist options
  • Save igalic/753509f96e526bd29897311ed8d915c7 to your computer and use it in GitHub Desktop.
Save igalic/753509f96e526bd29897311ed8d915c7 to your computer and use it in GitHub Desktop.
diff --git a/tests/unittests/distros/test__init__.py b/tests/unittests/distros/test__init__.py
index 4201c687f..17bf783a7 100644
--- a/tests/unittests/distros/test__init__.py
+++ b/tests/unittests/distros/test__init__.py
@@ -275,6 +275,25 @@ class TestGenericDistro(helpers.FilesystemMockingTestCase):
d.is_virtual, "Reflect unknown state on ProcessExecutionError"
)
+ @mock.patch(
+ "cloudinit.distros.subp.subp",
+ )
+ def test_virtualization_on_freebsd(self, m_subp):
+ m_subp.return_value = ("", None) # swallowed by `ifconfig -a`
+
+ cls = distros.fetch("freebsd")
+ d = cls("freebsd", {}, None)
+ with mock.patch(
+ "cloudinit.distros.subp.subp",
+ return_value=("0\n", None),
+ ):
+ with mock.patch(
+ "cloudinit.distros.subp.subp",
+ return_value=("hv\n", None),
+ ):
+ self.assertEqual(d.virtual(), "microsoft")
+ self.assertTrue(d.is_virtual)
+
class TestGetPackageMirrors:
def return_first(self, mlist):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment