py27 UT fails on centos7.2.1511

Bug #1681988 reported by Jeremy Liu on 2017-04-12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released
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/", line 410, in create_from
  File "barbican/model/", line 119, in save
  File "/root/", line 2139, in flush
  File "/root/", line 2259, in _flush
  File "/root/", line 66, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/root/", line 2223, in _flush
  File "/root/", line 389, in execute
  File "/root/", line 548, in execute
  File "/root/", line 181, in save_obj
    mapper, table, insert)
  File "/root/", line 835, in _emit_insert_statements
    execute(statement, params)
  File "/root/", line 945, in execute
    return meth(self, multiparams, params)
  File "/root/", line 263, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/root/", line 1053, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/root/", line 1189, in _execute_context
  File "/root/", line 1402, in _handle_dbapi_exception
  File "/root/", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/root/", line 1182, in _execute_context
  File "/root/", 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/", line 316, in test_do_entity_name
    self.assertIn("UNIQUE constraint", ex.message)
  File "/root/", line 417, in assertIn
    self.assertThat(haystack, Contains(needle), message)
  File "/root/", 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/
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 - 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

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 development milestone.

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

Other bug subscribers