<div dir="ltr">Hello Andrew,<div><br></div><div>here is the problem:</div><div><br></div><div><a href="https://review.openstack.org/#/c/78406/5/nailgun/nailgun/test/base.py">https://review.openstack.org/#/c/78406/5/nailgun/nailgun/test/base.py</a> line 268. </div>
<div>If you remove this this line then in <a href="https://review.openstack.org/#/c/78406/5/nailgun/nailgun/network/manager.py">https://review.openstack.org/#/c/78406/5/nailgun/nailgun/network/manager.py</a> `if` block from line 131 will be run, especially db.commit() which will save all pending changes, including new task_provision.weight value.<br>
</div><div><br></div><div><br></div><div>Regards</div><div><br></div><div> </div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Apr 12, 2014 at 12:33 AM, Andrew Woodward <span dir="ltr"><<a href="mailto:xarses@gmail.com" target="_blank">xarses@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Recently in one of my changes [1] I was fighting with one of the unit<br>
tests showing a failure for a test which should have been outside the<br>
sphere of influence.<br>
<br>
Traceback (most recent call last):<br>
  File "/home/andreww/.virtualenvs/fuel/local/lib/python2.7/site-packages/mock.py",<br>
line 1190, in patched<br>
    return func(*args, **keywargs)<br>
  File "/home/andreww/git/fuel-web/nailgun/nailgun/test/integration/test_task_managers.py",<br>
line 65, in test_deployment_task_managers<br>
    self.assertEquals(provision_task.weight, 0.4)<br>
AssertionError: 1.0 != 0.4<br>
<br>
After walking through a number of times and finally playing with it we<br>
where able to find that the db().refresh(task_provision) call appeared<br>
to be reseting the object. This caused the loss of the weight being<br>
set to 0.4 (1.0 is the model default). db().commit(), db().flush() and<br>
no call to db all caused the test to pass again.<br>
<br>
Does anyone have any input on why this would occur? The oddly odd part<br>
is that this test doesn't fail outside of the change set in [1]<br>
<br>
[1] <a href="https://review.openstack.org/#/c/78406/8/nailgun/nailgun/task/manager.py" target="_blank">https://review.openstack.org/#/c/78406/8/nailgun/nailgun/task/manager.py</a><br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Andrew<br>
Mirantis<br>
Ceph community<br>
<br>
_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Łukasz Oleś</div>
</div>