Sometimes OVO unit tests clash on non-unique attributes

Bug #1704000 reported by Ihar Hrachyshka
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Lujin Luo

Bug Description

ft1.22: neutron.tests.unit.objects.test_l3agent.RouterL3AgentBindingDbObjTestCase.test_update_objects_StringException: Traceback (most recent call last):
  File "neutron/tests/base.py", line 118, in func
    return f(self, *args, **kwargs)
  File "neutron/tests/unit/objects/test_base.py", line 1848, in test_update_objects
    self.context, new_values, **keys)
  File "neutron/objects/base.py", line 494, in update_objects
    **cls.modify_fields_to_db(kwargs))
  File "neutron/objects/db/api.py", line 103, in update_objects
    return q.update(values, synchronize_session=False)
  File "/home/jenkins/workspace/gate-neutron-python27-ubuntu-xenial/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 3345, in update
    update_op.exec_()
  File "/home/jenkins/workspace/gate-neutron-python27-ubuntu-xenial/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 1179, in exec_
    self._do_exec()
  File "/home/jenkins/workspace/gate-neutron-python27-ubuntu-xenial/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 1334, in _do_exec
    mapper=self.mapper)
  File "/home/jenkins/workspace/gate-neutron-python27-ubuntu-xenial/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 1139, in execute
    bind, close_with_result=True).execute(clause, params or {})
  File "/home/jenkins/workspace/gate-neutron-python27-ubuntu-xenial/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 945, in execute
    return meth(self, multiparams, params)
  File "/home/jenkins/workspace/gate-neutron-python27-ubuntu-xenial/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/home/jenkins/workspace/gate-neutron-python27-ubuntu-xenial/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/home/jenkins/workspace/gate-neutron-python27-ubuntu-xenial/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
    context)
  File "/home/jenkins/workspace/gate-neutron-python27-ubuntu-xenial/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1398, in _handle_dbapi_exception
    util.raise_from_cause(newraise, exc_info)
  File "/home/jenkins/workspace/gate-neutron-python27-ubuntu-xenial/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/home/jenkins/workspace/gate-neutron-python27-ubuntu-xenial/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/home/jenkins/workspace/gate-neutron-python27-ubuntu-xenial/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
oslo_db.exception.DBDuplicateEntry: (sqlite3.IntegrityError) UNIQUE constraint failed: routerl3agentbindings.router_id, routerl3agentbindings.binding_index [SQL: u'UPDATE routerl3agentbindings SET binding_index=? WHERE routerl3agentbindings.router_id IN (?) AND routerl3agentbindings.l3_agent_id IN (?)'] [parameters: (2, '2a0036c0-dfc8-4dee-b6e8-ae7039abb5e0', '98fa8bc4-d5be-422f-88a2-cfcd78a7f2d6')]

http://logs.openstack.org/73/304873/45/check/gate-neutron-python27-ubuntu-xenial/c6512d6/testr_results.html.gz

This is because of self.update_obj_fields used in several test classes not updating unique_tracker in the base test class that makes sure no non-unique values are generated by get_random_object_fields. We probably need to make those two cooperate.

Changed in neutron:
importance: Undecided → High
status: New → Confirmed
tags: added: gate-failure unittest
Revision history for this message
Ihar Hrachyshka (ihar-hrachyshka) wrote :
Changed in neutron:
assignee: nobody → Lujin Luo (luo-lujin)
status: Confirmed → In Progress
Revision history for this message
Lujin Luo (luo-lujin) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/485996

Revision history for this message
Ihar Hrachyshka (ihar-hrachyshka) wrote :

I believe this is fixed with https://review.openstack.org/485082

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by Lujin Luo (<email address hidden>) on branch: master
Review: https://review.openstack.org/485996
Reason: Fix released by <https://review.openstack.org/#/c/485082/>.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.