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

Andrew Woodward xarses at gmail.com
Fri Apr 11 22:33:24 UTC 2014


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



More information about the OpenStack-dev mailing list