Created
February 8, 2023 14:22
-
-
Save igalic/753509f96e526bd29897311ed8d915c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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