Reviewed: https://review.openstack.org/288561 Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=305980a41e1475074d2d1fa286dae2994a1b8b06 Submitter: Jenkins Branch: master
commit 305980a41e1475074d2d1fa286dae2994a1b8b06 Author: Ihar Hrachyshka <[email protected]> Date: Fri Mar 4 17:12:37 2016 +0100 Mock out database access for QoS policy object interface tests When we merged RBAC support for QoS policies, we missed mocking out database access triggered by RBAC metaclass hooks in this test. It made the test failing if executed on its own, since in that case no database was created in memory for those access attempts to succeed. Now, mock out all fetches consistently for all object interface test cases. Change-Id: I6f7b68ec993849077f859f2e86609022cbc0bcc1 Closes-Bug: #1553254 ** 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/1553254 Title: neutron.tests.unit.objects.qos.test_policy.QosPolicyObjectTestCase fails if executed separately Status in neutron: Fix Released Bug description: The test will fail if you execute just it as in: $ tox -e py27 neutron.tests.unit.objects.qos.test_policy.QosPolicyObjectTestCase ... Captured traceback: ~~~~~~~~~~~~~~~~~~~ Traceback (most recent call last): File "/home/vagrant/git/neutron/.tox/py27/lib/python2.7/site-packages/mock/mock.py", line 1305, in patched return func(*args, **keywargs) File "neutron/tests/unit/objects/test_base.py", line 238, in test_update_no_changes obj.update() File "neutron/objects/rbac_db.py", line 280, in func return new_method(self, orig_method) File "neutron/objects/rbac_db.py", line 212, in _update_hook _update_post(self) File "neutron/objects/rbac_db.py", line 206, in _update_post self.update_shared(self.shared, self.id) File "neutron/objects/rbac_db.py", line 189, in update_shared action=models.ACCESS_SHARED) File "neutron/db/api.py", line 95, in get_object .filter_by(**kwargs) File "/home/vagrant/git/neutron/.tox/py27/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2634, in first ret = list(self[0:1]) File "/home/vagrant/git/neutron/.tox/py27/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2457, in __getitem__ return list(res) File "/home/vagrant/git/neutron/.tox/py27/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2736, in __iter__ return self._execute_and_instances(context) File "/home/vagrant/git/neutron/.tox/py27/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2751, in _execute_and_instances result = conn.execute(querycontext.statement, self._params) File "/home/vagrant/git/neutron/.tox/py27/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 914, in execute return meth(self, multiparams, params) File "/home/vagrant/git/neutron/.tox/py27/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 323, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/home/vagrant/git/neutron/.tox/py27/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1010, in _execute_clauseelement compiled_sql, distilled_params File "/home/vagrant/git/neutron/.tox/py27/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context context) File "/home/vagrant/git/neutron/.tox/py27/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1337, in _handle_dbapi_exception util.raise_from_cause(newraise, exc_info) File "/home/vagrant/git/neutron/.tox/py27/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 200, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "/home/vagrant/git/neutron/.tox/py27/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context context) File "/home/vagrant/git/neutron/.tox/py27/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: qospolicyrbacs [SQL: u'SELECT qospolicyrbacs.tenant_id AS qospolicyrbacs_tenant_id, qospolicyrbacs.id AS qospolicyrbacs_id, qospolicyrbacs.target_tenant AS qospolicyrbacs_target_tenant, qospolicyrbacs.action AS qospolicyrbacs_action, qospolicyrbacs.object_id AS qospolicyrbacs_object_id \nFROM qospolicyrbacs \nWHERE qospolicyrbacs.object_id = ? AND qospolicyrbacs.action = ? AND qospolicyrbacs.target_tenant = ?\n LIMIT ? OFFSET ?'] [parameters: ('7777', 'access_as_shared', '*', 1, 0)] That's because RBAC mixin now triggers some fetches when updating policy. To manage notifications about this bug go to: https://bugs.launchpad.net/neutron/+bug/1553254/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

