Merge "Fix duplicated queues on multi pools"
This commit is contained in:
commit
ce731cfc71
@ -146,8 +146,9 @@ class QueueController(storage.Queue):
|
||||
|
||||
def all_pages():
|
||||
cursor = self._pool_catalog._pools_ctrl.list(limit=0)
|
||||
for pool in next(cursor):
|
||||
yield next(self._pool_catalog.get_driver(pool['name'])
|
||||
pools_list = list(next(cursor))
|
||||
anypool = pools_list and pools_list[0]
|
||||
yield next(self._pool_catalog.get_driver(anypool['name'])
|
||||
.queue_controller.list(
|
||||
project=project,
|
||||
marker=marker,
|
||||
|
@ -12,6 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
import mock
|
||||
import uuid
|
||||
|
||||
from zaqar.openstack.common.cache import cache as oslo_cache
|
||||
@ -105,3 +106,15 @@ class PoolCatalogTest(testing.TestBase):
|
||||
self.catalog.register,
|
||||
'test', project=self.project,
|
||||
flavor='fake')
|
||||
|
||||
def test_queues_list_on_multi_pools(self):
|
||||
def fake_list(project=None, marker=None, limit=10, detailed=False):
|
||||
yield iter([{'name': 'fake_queue'}])
|
||||
|
||||
list_str = 'zaqar.storage.mongodb.queues.QueueController.list'
|
||||
with mock.patch(list_str) as queues_list:
|
||||
queues_list.side_effect = fake_list
|
||||
queue_controller = pooling.QueueController(self.catalog)
|
||||
result = queue_controller.list(project=self.project)
|
||||
queue_list = list(next(result))
|
||||
self.assertEqual(1, len(queue_list))
|
||||
|
Loading…
Reference in New Issue
Block a user