yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #51537
[Bug 1584737] Re: Incorrect objects comparison in unit test
Reviewed: https://review.openstack.org/320220
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=b1973fc300b2cb2d476cd9b63184368e44a8fba9
Submitter: Jenkins
Branch: master
commit b1973fc300b2cb2d476cd9b63184368e44a8fba9
Author: Takashi NATSUME <natsume.takashi@xxxxxxxxxxxxx>
Date: Tue May 24 13:52:21 2016 +0900
Add length check in comparing object lists
Add length check when comparing a test result object list
and an expected object list
in nova/tests/unit/compute/test_host_api.py
Change-Id: I27c094d84a9ec17250d3e8046b0138080d404e3a
Closes-Bug: #1584737
** Changed in: nova
Status: In Progress => Fix Released
--
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):
Fix Released
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
References