yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #51386
[Bug 1584737] [NEW] Incorrect objects comparison in unit test
Public bug reported:
In nova/tests/unit/compute/test_host_api.py (commit bb50389bb6dcf891ae1f1ec7bd037efc462ce517),
there is the '_compare_objs' method for comparing test result objects and expected objects.
-----------------------------------------------------------------------
class ComputeHostAPITestCase(test.TestCase):
(snipped...)
def _compare_obj(self, obj, db_obj):
test_objects.compare_obj(self, obj, db_obj,
allow_missing=test_service.OPTIONAL)
def _compare_objs(self, obj_list, db_obj_list):
for index, obj in enumerate(obj_list):
self._compare_obj(obj, db_obj_list[index])
-----------------------------------------------------------------------
In '_compare_objs' method,
the inside of 'for' statement is never executed if obj_list (test result) is empty list([]).
In that case, there is a possibility to overlook the difference between test result obejcts and expected objects.
It is a potential bug. So it should be fixed.
* This bug was found in the following patch.
https://review.openstack.org/#/c/308213/1/nova/tests/unit/compute/test_host_api.py
** Affects: nova
Importance: Undecided
Assignee: Takashi NATSUME (natsume-takashi)
Status: New
** Changed in: nova
Assignee: (unassigned) => Takashi NATSUME (natsume-takashi)
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1584737
Title:
Incorrect objects comparison in unit test
Status in OpenStack Compute (nova):
New
Bug description:
In nova/tests/unit/compute/test_host_api.py (commit bb50389bb6dcf891ae1f1ec7bd037efc462ce517),
there is the '_compare_objs' method for comparing test result objects and expected objects.
-----------------------------------------------------------------------
class ComputeHostAPITestCase(test.TestCase):
(snipped...)
def _compare_obj(self, obj, db_obj):
test_objects.compare_obj(self, obj, db_obj,
allow_missing=test_service.OPTIONAL)
def _compare_objs(self, obj_list, db_obj_list):
for index, obj in enumerate(obj_list):
self._compare_obj(obj, db_obj_list[index])
-----------------------------------------------------------------------
In '_compare_objs' method,
the inside of 'for' statement is never executed if obj_list (test result) is empty list([]).
In that case, there is a possibility to overlook the difference between test result obejcts and expected objects.
It is a potential bug. So it should be fixed.
* This bug was found in the following patch.
https://review.openstack.org/#/c/308213/1/nova/tests/unit/compute/test_host_api.py
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1584737/+subscriptions
Follow ups