[openstack-dev] [nova] need help with unit test framework, trying to fix bug 1292963
Chris Friesen
chris.friesen at windriver.com
Mon Mar 17 21:16:07 UTC 2014
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?
Thanks,
Chris
More information about the OpenStack-dev
mailing list