The devname referenced in your traceback should be the result of get_devicelist(), which should be mocked.#1356
Merged
Merged
Conversation
Signed-off-by: yangzz-97 <yangzz-97@1162011203@qq.com>
Contributor
|
@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: |
added 5 commits
March 31, 2022 20:45
…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>
Contributor
Author
|
@TheRealFalcon |
Contributor
Author
|
Maybe I didn't do it right and made a lot of commits |
This was referenced May 12, 2023
Closed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: