Fixes fakes and adds version param
This patch changes the fakes interface in order to fit better with Zaqar's client and adds the version parameter to initialization for a more flexible benchmarking. Change-Id: I0a12562cfa4f7a7e1bcff35f95c59e12368e7fdf
This commit is contained in:
parent
beab98a853
commit
f2ca4c8eb3
@ -263,7 +263,7 @@ class Clients(object):
|
||||
return client
|
||||
|
||||
@cached
|
||||
def zaqar(self):
|
||||
def zaqar(self, version=1.1):
|
||||
"""Return Zaqar client."""
|
||||
kc = self.keystone()
|
||||
messaging_api_url = kc.service_catalog.url_for(
|
||||
@ -278,7 +278,7 @@ class Clients(object):
|
||||
'insecure': CONF.https_insecure,
|
||||
}}}
|
||||
client = zaqar.Client(url=messaging_api_url,
|
||||
version='1.1',
|
||||
version=version,
|
||||
conf=conf)
|
||||
return client
|
||||
|
||||
|
@ -151,7 +151,7 @@ class CleanupUtilsTestCase(test.TestCase):
|
||||
def test_delete_zaqar_resources(self):
|
||||
zaqar = fakes.FakeClients().zaqar()
|
||||
messages = [{'body': {'id': idx}, 'ttl': 360} for idx in range(20)]
|
||||
queue = zaqar.create_queue()
|
||||
queue = zaqar.queue("fizbit")
|
||||
queue.post_message(messages)
|
||||
messages_no = lambda queue: (len(queue.messages.list()))
|
||||
queues_no = lambda zaqar: (len(zaqar.queues.list()))
|
||||
|
@ -1122,8 +1122,8 @@ class FakeZaqarClient(object):
|
||||
def __init__(self):
|
||||
self.queues = FakeQueuesManager()
|
||||
|
||||
def create_queue(self):
|
||||
return self.queues.create("fizbit")
|
||||
def queue(self, name, **kwargs):
|
||||
return self.queues.create(name, **kwargs)
|
||||
|
||||
|
||||
class FakeClients(object):
|
||||
|
@ -243,7 +243,7 @@ class OSClientsTestCase(test.TestCase):
|
||||
'insecure': cfg.CONF.https_insecure,
|
||||
}}}
|
||||
mock_zaqar.Client.assert_called_once_with(url=fake_zaqar_url,
|
||||
version="1.1",
|
||||
version=1.1,
|
||||
conf=conf)
|
||||
self.assertEqual(self.clients.cache["zaqar"], fake_zaqar)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user