[openstack-dev] [nova] need help with unit test framework, trying to fix bug 1292963

Joe Gordon joe.gordon0 at gmail.com
Mon Mar 17 22:04:56 UTC 2014


On Mon, Mar 17, 2014 at 2:16 PM, Chris Friesen
<chris.friesen at windriver.com>wrote:
>> I've submitted code for review at "https://review.openstack.org/80808"
> but it seems to break the unit tests.
>> Where do the "deleted" and "deleted_at" fields for the instance get
> created for unit tests? Where is the database stored for unit tests, and
> is there a way to look at it directly?
>> Here is what's confusing me. I added a breakpoint in the testcase at the
> point where it's trying to retrieve the instances.
>>> The original code looks like this:
>> filters = {'uuid': filter_uuids, 'deleted_at': None}
> instances = instance_obj.InstanceList.get_by_filters(context,
> filters=filters)
>> If I run that code, I get three instances, as expected.
>>> If I change it to "filters = {'uuid': filter_uuids, 'deleted': 0}" and
> rerun get_by_filters() then I get no instances in the result.
>>> However, if I run "db.instance_get_all()" and look at the result, there
> are three instances and the "deleted" field is zero in each case:
>> (Pdb) db.instance_get_all(context)[0]['deleted']
> 0
> (Pdb) db.instance_get_all(context)[1]['deleted']
> 0
> (Pdb) db.instance_get_all(context)[2]['deleted']
> 0
>>> So why does it fail if I try and filter by the "deleted" field?

See
http://git.openstack.org/cgit/openstack/nova/tree/nova/db/sqlalchemy/api.py#n1848
>>> Thanks,
> Chris
>> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140317/39447a32/attachment.html>


More information about the OpenStack-dev mailing list

AltStyle によって変換されたページ (->オリジナル) /