Enable shards test for sqlalchemy
Now we have already implemented the sqlalchemy for shards and catalogue, so this patch will enable the shards test for sqlalchemy. Closes-Bug: #1288148 Change-Id: I1bc96419f2525d5211448d68c8c871dda14535a7
This commit is contained in:
parent
364945f990
commit
8835aee20c
@ -44,3 +44,4 @@ TestQueueFaultyDriver = lc.TestQueueLifecycleFaultyDriver
|
||||
TestQueueLifecycleMongoDB = lc.TestQueueLifecycleMongoDB
|
||||
TestQueueLifecycleSqlalchemy = lc.TestQueueLifecycleSqlalchemy
|
||||
TestShardsMongoDB = test_shards.TestShardsMongoDB
|
||||
TestShardsSqlalchemy = test_shards.TestShardsSqlalchemy
|
||||
|
@ -459,10 +459,6 @@ class TestMessagesSqlalchemy(MessagesBaseTest):
|
||||
config_file = 'wsgi_sqlalchemy.conf'
|
||||
|
||||
|
||||
# TODO(cpp-cabrera): restore sqlalchemy sharded test suite once shards and
|
||||
# catalogue get an sqlalchemy implementation.
|
||||
|
||||
|
||||
class TestMessagesMongoDB(MessagesBaseTest):
|
||||
|
||||
config_file = 'wsgi_mongodb.conf'
|
||||
|
@ -252,7 +252,14 @@ class ShardsBaseTest(base.TestBase):
|
||||
self.assertIn('shards', results)
|
||||
shard_list = results['shards']
|
||||
self.assertEqual(len(shard_list), min(limit, count))
|
||||
for (i, s), expect in zip(enumerate(shard_list), expected):
|
||||
for s in shard_list:
|
||||
# NOTE(flwang): It can't assumed that both sqlalchemy and
|
||||
# mongodb can return query result with the same order. Just
|
||||
# like the order they're inserted. Actually, sqlalchemy can't
|
||||
# guarantee that. So we're leveraging the relationship between
|
||||
# shard weight and the index of shards fixture to get the
|
||||
# right shard to verify.
|
||||
expect = expected[s['weight']]
|
||||
path, weight = expect[:2]
|
||||
self._shard_expect(s, path, weight, self.doc['uri'])
|
||||
if detailed:
|
||||
@ -291,3 +298,11 @@ class TestShardsMongoDB(ShardsBaseTest):
|
||||
@testing.requires_mongodb
|
||||
def setUp(self):
|
||||
super(TestShardsMongoDB, self).setUp()
|
||||
|
||||
|
||||
class TestShardsSqlalchemy(ShardsBaseTest):
|
||||
|
||||
config_file = 'wsgi_sqlalchemy.conf'
|
||||
|
||||
def setUp(self):
|
||||
super(TestShardsSqlalchemy, self).setUp()
|
||||
|
@ -86,6 +86,10 @@ class TestShardsMongoDB(wsgi.TestShardsMongoDB):
|
||||
url_prefix = URL_PREFIX
|
||||
|
||||
|
||||
class TestShardsSqlalchemy(wsgi.TestShardsSqlalchemy):
|
||||
url_prefix = URL_PREFIX
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# v1.0 only
|
||||
#----------------------------------------------------------------------------
|
||||
|
@ -88,6 +88,10 @@ class TestShardsMongoDB(wsgi.TestShardsMongoDB):
|
||||
url_prefix = URL_PREFIX
|
||||
|
||||
|
||||
class TestShardsSqlalchemy(wsgi.TestShardsSqlalchemy):
|
||||
url_prefix = URL_PREFIX
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# v1.1 only
|
||||
#----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user