cloud-init/backport-testing-add-additional-mocks-to-test_net-tests-1356.patch
yang_zhuang_zhuang 05ab55c327 update to 22.1
fix test_net.py testcase fail
add Reauires cloud-init-hotplugd.socket in cloud-init-hotplugd.service file
2022-04-06 09:26:27 +08:00

42 lines
1.3 KiB
Diff

From d8f39d79fcdb548252823949a4b24f49a00e8c27 Mon Sep 17 00:00:00 2001
From: yangzz-97 <70520104+yangzz-97@users.noreply.github.com>
Date: Thu, 31 Mar 2022 22:00:33 +0800
Subject: [PATCH 193/195] testing: add additional mocks to test_net tests
(#1356)
Tests in tests/unittests/test_net.py::TestGetInterfaces were missing
mocks for bond and failover calls.
Signed-off-by: yangzz-97 <yangzz-97@1162011203@qq.com>
---
tests/unittests/test_net.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
index fa8b99a0..6844c329 100644
--- a/tests/unittests/test_net.py
+++ b/tests/unittests/test_net.py
@@ -7454,6 +7454,12 @@ class TestGetInterfaces(CiTestCase):
def _se_interface_has_own_mac(self, name):
return name in self.data["own_macs"]
+ def _se_is_bond(self, name):
+ return name in self.data["bonds"]
+
+ def _se_is_netfailover(self, name):
+ return False
+
def _mock_setup(self):
self.data = copy.deepcopy(self._data)
self.data["devices"] = set(list(self.data["macs"].keys()))
@@ -7465,6 +7471,8 @@ class TestGetInterfaces(CiTestCase):
"is_vlan",
"device_driver",
"device_devid",
+ "is_bond",
+ "is_netfailover",
)
self.mocks = {}
for n in mocks:
--
2.27.0