Fix bad calls to model_query()
model_query() function was changed recently to use 'model' object as a second positional argument, so all callers need to adhere to this requirement. Fix 'bad' model_query(). Remove 'skips' from tests that were failing due to bad model_query() calls. Closes-Bug: #1275026 Change-Id: Ibf3d45c6a37493cc0ced7cc6e6c552f27b6e4338
This commit is contained in:
parent
0f6a7cb422
commit
6de896e5c5
manila
@ -340,7 +340,7 @@ def service_get_all_share_sorted(context):
|
||||
with session.begin():
|
||||
topic = CONF.share_topic
|
||||
label = 'share_gigabytes'
|
||||
subq = model_query(context, models.Share.host,
|
||||
subq = model_query(context, models.Share, models.Share.host,
|
||||
func.sum(models.Share.size).label(label),
|
||||
session=session, read_deleted="no").\
|
||||
group_by(models.Share.host).\
|
||||
@ -405,9 +405,9 @@ def quota_get(context, project_id, resource, session=None):
|
||||
def quota_get_all_by_project_and_user(context, project_id, user_id):
|
||||
authorize_project_context(context, project_id)
|
||||
|
||||
user_quotas = model_query(context, models.ProjectUserQuota.resource,
|
||||
models.ProjectUserQuota.hard_limit,
|
||||
base_model=models.ProjectUserQuota).\
|
||||
user_quotas = model_query(context, models.ProjectUserQuota,
|
||||
models.ProjectUserQuota.resource,
|
||||
models.ProjectUserQuota.hard_limit).\
|
||||
filter_by(project_id=project_id).\
|
||||
filter_by(user_id=user_id).\
|
||||
all()
|
||||
@ -1087,7 +1087,7 @@ def share_create(context, values):
|
||||
|
||||
@require_admin_context
|
||||
def share_data_get_for_project(context, project_id, user_id, session=None):
|
||||
query = model_query(context,
|
||||
query = model_query(context, models.Share,
|
||||
func.count(models.Share.id),
|
||||
func.sum(models.Share.size),
|
||||
read_deleted="no",
|
||||
@ -1249,7 +1249,7 @@ def share_snapshot_create(context, values):
|
||||
|
||||
@require_admin_context
|
||||
def snapshot_data_get_for_project(context, project_id, user_id, session=None):
|
||||
query = model_query(context,
|
||||
query = model_query(context, models.ShareSnapshot,
|
||||
func.count(models.ShareSnapshot.id),
|
||||
func.sum(models.ShareSnapshot.size),
|
||||
read_deleted="no",
|
||||
@ -1311,7 +1311,7 @@ def share_snapshot_get_all_for_share(context, share_id):
|
||||
@require_context
|
||||
def share_snapshot_data_get_for_project(context, project_id, session=None):
|
||||
authorize_project_context(context, project_id)
|
||||
result = model_query(context,
|
||||
result = model_query(context, models.ShareSnapshot,
|
||||
func.count(models.ShareSnapshot.id),
|
||||
func.sum(models.ShareSnapshot.share_size),
|
||||
read_deleted="no",
|
||||
|
@ -86,9 +86,6 @@ def fake_update_share_metadata(self, context, share, diff):
|
||||
pass
|
||||
|
||||
|
||||
@test.skip_test("Skip because of DB migration #10")
|
||||
#NOTE(achirko): There should be no interaction between DB on 'share_api
|
||||
# creation'
|
||||
class ShareMetaDataTest(test.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
@ -1064,7 +1064,6 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
dict(shares=2), expire='invalid')
|
||||
self.assertEqual(self.calls, [])
|
||||
|
||||
@test.skip_test('Skip due to failure after DB migration #10')
|
||||
def test_reserve_default_expire(self):
|
||||
self._stub_get_project_quotas()
|
||||
self._stub_quota_reserve()
|
||||
@ -1077,7 +1076,6 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
('quota_reserve', expire, 0, 0), ])
|
||||
self.assertEqual(result, ['resv-1', 'resv-2', 'resv-3'])
|
||||
|
||||
@test.skip_test('Skip due to failure after DB migration #10')
|
||||
def test_reserve_int_expire(self):
|
||||
self._stub_get_project_quotas()
|
||||
self._stub_quota_reserve()
|
||||
@ -1090,7 +1088,6 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
('quota_reserve', expire, 0, 0), ])
|
||||
self.assertEqual(result, ['resv-1', 'resv-2', 'resv-3'])
|
||||
|
||||
@test.skip_test('Skip due to failure after DB migration #10')
|
||||
def test_reserve_timedelta_expire(self):
|
||||
self._stub_get_project_quotas()
|
||||
self._stub_quota_reserve()
|
||||
@ -1104,7 +1101,6 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
('quota_reserve', expire, 0, 0), ])
|
||||
self.assertEqual(result, ['resv-1', 'resv-2', 'resv-3'])
|
||||
|
||||
@test.skip_test('Skip due to failure after DB migration #10')
|
||||
def test_reserve_datetime_expire(self):
|
||||
self._stub_get_project_quotas()
|
||||
self._stub_quota_reserve()
|
||||
@ -1117,7 +1113,6 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
('quota_reserve', expire, 0, 0), ])
|
||||
self.assertEqual(result, ['resv-1', 'resv-2', 'resv-3'])
|
||||
|
||||
@test.skip_test('Skip due to failure after DB migration #10')
|
||||
def test_reserve_until_refresh(self):
|
||||
self._stub_get_project_quotas()
|
||||
self._stub_quota_reserve()
|
||||
@ -1131,7 +1126,6 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
('quota_reserve', expire, 500, 0), ])
|
||||
self.assertEqual(result, ['resv-1', 'resv-2', 'resv-3'])
|
||||
|
||||
@test.skip_test('Skip due to failure after DB migration #10')
|
||||
def test_reserve_max_age(self):
|
||||
self._stub_get_project_quotas()
|
||||
self._stub_quota_reserve()
|
||||
|
Loading…
x
Reference in New Issue
Block a user