← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1585941] Re: neutron.tests.unit.objects.test_subnetpool.SubnetPoolDbObjectTestCase.test_subnetpool_prefixes fails due to "UNIQUE constraint failed"

 

Reviewed:  https://review.openstack.org/321418
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=543e960eb7cb5379d306035539c9e3d526655e47
Submitter: Jenkins
Branch:    master

commit 543e960eb7cb5379d306035539c9e3d526655e47
Author: Ihar Hrachyshka <ihrachys@xxxxxxxxxx>
Date:   Thu May 26 10:42:01 2016 +0200

    tests: guarantee unique networks in get_list_of_random_networks
    
    The function generates a list of random networks, but so far did not
    guarantee their uniqueness. In rare cases, it breaks
    test_subnetpool_prefixes unit test in gate that relies on those networks
    to be unique.
    
    Now, the function will regenerate the result several times if duplicates
    are detected.
    
    Change-Id: Ia300e36ad7a25dd156ac8b5f27dcdeeaa5339ab8
    Closes-Bug: #1585941


** Changed in: neutron
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1585941

Title:
  neutron.tests.unit.objects.test_subnetpool.SubnetPoolDbObjectTestCase.test_subnetpool_prefixes
  fails due to "UNIQUE constraint failed"

Status in neutron:
  Fix Released

Bug description:
  http://logs.openstack.org/63/294463/12/check/gate-neutron-
  python34/c46683d/testr_results.html.gz

  ft398.3: neutron.tests.unit.objects.test_subnetpool.SubnetPoolDbObjectTestCase.test_subnetpool_prefixes_StringException: Empty attachments:
    pythonlogging:''
    stderr
    stdout

  Traceback (most recent call last):
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
      context)
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute
      cursor.execute(statement, parameters)
  sqlite3.IntegrityError: UNIQUE constraint failed: subnetpoolprefixes.cidr, subnetpoolprefixes.subnetpool_id

  The above exception was the direct cause of the following exception:

  Traceback (most recent call last):
    File "/home/jenkins/workspace/gate-neutron-python34/neutron/objects/base.py", line 331, in create
      self.modify_fields_to_db(fields))
    File "/home/jenkins/workspace/gate-neutron-python34/neutron/objects/db/api.py", line 39, in create_object
      context.session.add(db_obj)
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 490, in __exit__
      self.rollback()
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
      compat.reraise(exc_type, exc_value, exc_tb)
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 186, in reraise
      raise value
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 487, in __exit__
      self.commit()
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 392, in commit
      self._prepare_impl()
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 372, in _prepare_impl
      self.session.flush()
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 2019, in flush
      self._flush(objects)
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 2137, in _flush
      transaction.rollback(_capture_exception=True)
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
      compat.reraise(exc_type, exc_value, exc_tb)
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 186, in reraise
      raise value
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 2101, in _flush
      flush_context.execute()
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/orm/unitofwork.py", line 373, in execute
      rec.execute(self)
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/orm/unitofwork.py", line 532, in execute
      uow
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/orm/persistence.py", line 174, in save_obj
      mapper, table, insert)
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/orm/persistence.py", line 767, in _emit_insert_statements
      execute(statement, multiparams)
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 914, in execute
      return meth(self, multiparams, params)
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/sql/elements.py", line 323, in _execute_on_connection
      return connection._execute_clauseelement(self, multiparams, params)
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1010, in _execute_clauseelement
      compiled_sql, distilled_params
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context
      context)
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1337, in _handle_dbapi_exception
      util.raise_from_cause(newraise, exc_info)
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 202, in raise_from_cause
      reraise(type(exception), exception, tb=exc_tb, cause=cause)
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 185, in reraise
      raise value.with_traceback(tb)
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
      context)
    File "/home/jenkins/workspace/gate-neutron-python34/.tox/py34/lib/python3.4/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute
      cursor.execute(statement, parameters)
  oslo_db.exception.DBDuplicateEntry: (sqlite3.IntegrityError) UNIQUE constraint failed: subnetpoolprefixes.cidr, subnetpoolprefixes.subnetpool_id [SQL: 'INSERT INTO subnetpoolprefixes (cidr, subnetpool_id) VALUES (?, ?)'] [parameters: ('10.108.160.0/24', '97ba4c5c-7416-4667-957d-43e655fb1c1b')]

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/home/jenkins/workspace/gate-neutron-python34/neutron/tests/unit/objects/test_subnetpool.py", line 53, in test_subnetpool_prefixes
      self._pool.update()
    File "/home/jenkins/workspace/gate-neutron-python34/neutron/objects/subnetpool.py", line 136, in update
      prefix_obj.create()
    File "/home/jenkins/workspace/gate-neutron-python34/neutron/objects/base.py", line 334, in create
      object_class=self.__class__, db_exception=db_exc)
  neutron.objects.base.NeutronDbObjectDuplicateEntry: Failed to create a duplicate SubnetPoolPrefix: for attribute(s) ['cidr', 'subnetpool_id'] with value(s) None

  
  This probably occurs because get_list_of_random_networks generates a list of networks that is not guaranteed to be unique.

  Logstash:
  http://logstash.openstack.org/#dashboard/file/logstash.json?query=message%3A%5C%22Failed%20to%20create%20a%20duplicate%20SubnetPoolPrefix%5C%22
  (2 hits in 2 days)

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1585941/+subscriptions


References