[openstack-dev] [fuel] oddness with sqlalchemy db().refresh(object)

Łukasz Oleś loles at mirantis.com
Mon Apr 14 23:59:02 UTC 2014


Hello Andrew,

here is the problem:

https://review.openstack.org/#/c/78406/5/nailgun/nailgun/test/base.py line
268.
If you remove this this line then in
https://review.openstack.org/#/c/78406/5/nailgun/nailgun/network/manager.py`if`
block from line 131 will be run, especially db.commit() which will
save all pending changes, including new task_provision.weight value.


Regards




On Sat, Apr 12, 2014 at 12:33 AM, Andrew Woodward <xarses at gmail.com> wrote:

> Recently in one of my changes [1] I was fighting with one of the unit
> tests showing a failure for a test which should have been outside the
> sphere of influence.
>
> Traceback (most recent call last):
>   File
> "/home/andreww/.virtualenvs/fuel/local/lib/python2.7/site-packages/mock.py",
> line 1190, in patched
>     return func(*args, **keywargs)
>   File
> "/home/andreww/git/fuel-web/nailgun/nailgun/test/integration/test_task_managers.py",
> line 65, in test_deployment_task_managers
>     self.assertEquals(provision_task.weight, 0.4)
> AssertionError: 1.0 != 0.4
>
> After walking through a number of times and finally playing with it we
> where able to find that the db().refresh(task_provision) call appeared
> to be reseting the object. This caused the loss of the weight being
> set to 0.4 (1.0 is the model default). db().commit(), db().flush() and
> no call to db all caused the test to pass again.
>
> Does anyone have any input on why this would occur? The oddly odd part
> is that this test doesn't fail outside of the change set in [1]
>
> [1]
> https://review.openstack.org/#/c/78406/8/nailgun/nailgun/task/manager.py
>
> --
> Andrew
> Mirantis
> Ceph community
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>



-- 
Łukasz Oleś
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140415/b6e641bf/attachment.html>


More information about the OpenStack-dev mailing list