-
Notifications
You must be signed in to change notification settings - Fork 911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The devname referenced in your traceback should be the result of get_devicelist(), which should be mocked. #1356
Conversation
Signed-off-by: yangzz-97 <yangzz-97@1162011203@qq.com>
@yangzz-97 , I'm not exactly sure what's going on. The devname referenced in your traceback should be the result of get_devicelist(), which should be mocked. I think there might be a bigger mocking issue that your change doesn't address. Does a patch like this work for you? 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: |
…devicelist(), which should be mocked. Signed-off-by: yangzz-97 <yangzz-97@1162011203@qq.com>
…devicelist(), which should be mocked. Signed-off-by: yangzz-97 <yangzz-97@1162011203@qq.com>
@TheRealFalcon |
Maybe I didn't do it right and made a lot of commits |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Hello
I am executing the cloud-init test case and the testcase has occasionally failed.
The failure testcases are:
FAILED tests/unittests/test_net.py::TestGetInterfaces::test_gi_excludes_any_without_mac_address
FAILED tests/unittests/test_net.py::TestGetInterfaces::test_gi_excludes_stolen_macs
FAILED tests/unittests/test_net.py::TestGetInterfaces::test_gi_includes_duplicate_macs
The error log for each failed use case is similar as follows: