There was a unit test added to check that, when a share type with name "ABC" exists, another share type's name cannot be updated to be "ABC". This collision in names is guarded by uniqueness constraints in the "share_types" and "share_group_types" tables [1][2][3][4].
However, unit tests run on Sqlite, and this constraint isn't holding.
Captured traceback:
~~~~~~~~~~~~~~~~~~~
Traceback (most recent call last):
File "manila/tests/db/sqlalchemy/test_api.py", line 3285, in test_share_type_update_name_exist
self.ctxt, share_type['id'], values)
File "/home/zuul/src/opendev.org/openstack/manila/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 485, in assertRaises self.assertThat(our_callable, matcher)
File "/home/zuul/src/opendev.org/openstack/manila/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 498, in assertThat
raise mismatch_error
testtools.matchers._impl.MismatchError: <function share_type_update at 0x7f8d9c0fd938> returned None
This bug is a result of the code review iterations on https:/ /review. opendev. org/#/c/ 669651/.
There was a unit test added to check that, when a share type with name "ABC" exists, another share type's name cannot be updated to be "ABC". This collision in names is guarded by uniqueness constraints in the "share_types" and "share_group_types" tables [1][2][3][4].
However, unit tests run on Sqlite, and this constraint isn't holding.
The unit test that failed: https:/ /review. opendev. org/#/c/ 669651/ 27/manila/ tests/db/ sqlalchemy/ test_api. py@3278
manila/ tests/db/ sqlalchemy/ test_api. py
def test_share_ type_update_ name_exist( self):
db_utils. create_ share_type(
name= 'exist_ name', extra_specs= {'somekey' : 'someval'}) create_ share_type( name='regalia' )
self.assertRai ses(exception. ShareTypeExists ,
db_ api.share_ type_update,
self. ctxt, share_type['id'], values)
share_type = db_utils.
values = {"name": "exist_name"}
Failure observed in the unit tests:
Captured traceback: ~~~~~~~ ~~~~~~~ ~~ tests/db/ sqlalchemy/ test_api. py", line 3285, in test_share_ type_update_ name_exist zuul/src/ opendev. org/openstack/ manila/ .tox/py27/ local/lib/ python2. 7/site- packages/ testtools/ testcase. py", line 485, in assertRaises
self.assertTha t(our_callable, matcher) zuul/src/ opendev. org/openstack/ manila/ .tox/py27/ local/lib/ python2. 7/site- packages/ testtools/ testcase. py", line 498, in assertThat matchers. _impl.MismatchE rror: <function share_type_update at 0x7f8d9c0fd938> returned None
~~~
Traceback (most recent call last):
File "manila/
self.ctxt, share_type['id'], values)
File "/home/
File "/home/
raise mismatch_error
testtools.