py27 UT fails on centos7.2.1511

Bug #1681988 reported by Jeremy Liu on 2017-04-12
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Barbican
Fix Released
High
Dave McCowan

Bug Description

When I run local unit tests using `tox -e py27` from master branch, get 3 tests fail related with database API testcases. See the following logs for more details.

Traceback (most recent call last):
  File "barbican/model/repositories.py", line 410, in create_from
    entity.save(session=session)
  File "barbican/model/models.py", line 119, in save
    session.flush()
  File "/root/git.openstack.org/barbican/.tox/py27/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 2139, in flush
    self._flush(objects)
  File "/root/git.openstack.org/barbican/.tox/py27/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 2259, in _flush
    transaction.rollback(_capture_exception=True)
  File "/root/git.openstack.org/barbican/.tox/py27/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 66, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/root/git.openstack.org/barbican/.tox/py27/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 2223, in _flush
    flush_context.execute()
  File "/root/git.openstack.org/barbican/.tox/py27/lib/python2.7/site-packages/sqlalchemy/orm/unitofwork.py", line 389, in execute
    rec.execute(self)
  File "/root/git.openstack.org/barbican/.tox/py27/lib/python2.7/site-packages/sqlalchemy/orm/unitofwork.py", line 548, in execute
    uow
  File "/root/git.openstack.org/barbican/.tox/py27/lib/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 181, in save_obj
    mapper, table, insert)
  File "/root/git.openstack.org/barbican/.tox/py27/lib/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 835, in _emit_insert_statements
    execute(statement, params)
  File "/root/git.openstack.org/barbican/.tox/py27/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 945, in execute
    return meth(self, multiparams, params)
  File "/root/git.openstack.org/barbican/.tox/py27/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/root/git.openstack.org/barbican/.tox/py27/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/root/git.openstack.org/barbican/.tox/py27/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
    context)
  File "/root/git.openstack.org/barbican/.tox/py27/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
    exc_info
  File "/root/git.openstack.org/barbican/.tox/py27/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 "/root/git.openstack.org/barbican/.tox/py27/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/root/git.openstack.org/barbican/.tox/py27/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
IntegrityError: (sqlite3.IntegrityError) column project_id is not unique [SQL: u'INSERT INTO project_secret_store (id, created_at, updated_at, deleted_at, deleted, status, secret_store_id, project_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?)'] [parameters: ('685a2fd4-228e-465a-a794-a5f6ac82e714', '2017-04-12 02:22:51.250918', '2017-04-12 02:22:51.250918', None, 0, 'ACTIVE', u'd501ab9c-baa6-4731-b566-3331933638c4', u'f89919e3-0041-4a55-9c6e-b5d0f9fc1ce7')]
}}}

Traceback (most recent call last):
  File "barbican/tests/model/repositories/test_repositories_secret_stores.py", line 316, in test_do_entity_name
    self.assertIn("UNIQUE constraint", ex.message)
  File "/root/git.openstack.org/barbican/.tox/py27/lib/python2.7/site-packages/testtools/testcase.py", line 417, in assertIn
    self.assertThat(haystack, Contains(needle), message)
  File "/root/git.openstack.org/barbican/.tox/py27/lib/python2.7/site-packages/testtools/testcase.py", line 498, in assertThat
    raise mismatch_error
testtools.matchers._impl.MismatchError: 'UNIQUE constraint' not in u"A defined SQL constraint check failed: 'column project_id is not unique',"
2017-04-11 19:22:55.304 DEBUG barbican.api.middleware.simple [req-351b9920-6a9f-45d4-8a91-e6ca02c2c828 None None] Calling SimpleFilter from (pid=84430) process_request barbican/api/middleware/simple.py:34
Ran 1435 (+626) tests in 65.067s (-726.147s)
FAILED (id=72, failures=3 (-28), skips=4)
error: testr failed (1)

I'm using centos7.2.1511 and python 2.7.5. Not sure whether this is related with my local environment.

Also I get different test results when testing this patch https://review.openstack.org/#/c/445722/ - my local py27 test runs successfully while the community py27 test fails.

Looking forward to your comments !

Changed in barbican:
assignee: nobody → Dave McCowan (dave-mccowan)
importance: Undecided → High
milestone: none → pike-2
status: New → In Progress

Reviewed: https://review.openstack.org/457625
Committed: https://git.openstack.org/cgit/openstack/barbican/commit/?id=f4fc902fdbf269c799cef78eea98b79970131b49
Submitter: Jenkins
Branch: master

commit f4fc902fdbf269c799cef78eea98b79970131b49
Author: Dave McCowan <email address hidden>
Date: Tue Apr 18 09:01:19 2017 -0400

    Fix test cases expect Ubuntu specific assertion messages

    Ubuntu and CentOS throw different exception messages for
    SQL contraint checking. The test cases can only assume
    assertion messages created by Barbican.

    Change-Id: Ic1ef76acbe178cfd5c6f2d3ab9ff97c652a3e604
    Closes-bug: #1681988

Changed in barbican:
status: In Progress → Fix Released

This issue was fixed in the openstack/barbican 5.0.0.0b2 development milestone.

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

Other bug subscribers