Move rally.osclients.Clients to plugin base
Current implementation is not flexible. In near future(I suppose it will be done in next patch) an ability of setting clients versions will be added. Also, the same situation with service types. Each client have each own validation(nova supports microversions, designate accepts only str values of version, zaqar accepts only int values and etc). Moving from method for client initialization to classes(Plugin-based) allows to implement unique validations when it required. Also, this patch unify usage of designateclient: use designateclient.client.Client entry-point instead of hardcoded versioned module. Change-Id: Iefe2edf2be97708fe761624711a62cdcd109ccc3
This commit is contained in:
@@ -148,19 +148,20 @@ class SaharaImageTestCase(test.ScenarioTestCase):
|
||||
sahara_ctx.cleanup()
|
||||
self.assertEqual(False, mock_cleanup.called)
|
||||
|
||||
@mock.patch("%s.osclients.Clients.glance" % CTX)
|
||||
def test_check_existing_image(self, mock_clients_glance):
|
||||
@mock.patch("%s.osclients.Glance.create_client" % CTX)
|
||||
def test_check_existing_image(self, mock_glance_create_client):
|
||||
|
||||
ctx = self.existing_image_context
|
||||
sahara_ctx = sahara_image.SaharaImage(ctx)
|
||||
sahara_ctx.setup()
|
||||
|
||||
mock_clients_glance.images.get.asser_called_once_with("some_id")
|
||||
mock_glance_create_client.images.get.asser_called_once_with("some_id")
|
||||
|
||||
@mock.patch("%s.osclients.Clients.glance" % CTX)
|
||||
def test_check_existing_private_image_fail(self, mock_clients_glance):
|
||||
@mock.patch("%s.osclients.Glance.create_client" % CTX)
|
||||
def test_check_existing_private_image_fail(self,
|
||||
mock_glance_create_client):
|
||||
|
||||
mock_clients_glance.return_value.images.get.return_value = (
|
||||
mock_glance_create_client.return_value.images.get.return_value = (
|
||||
mock.MagicMock(is_public=False))
|
||||
|
||||
ctx = self.existing_image_context
|
||||
@@ -168,4 +169,4 @@ class SaharaImageTestCase(test.ScenarioTestCase):
|
||||
self.assertRaises(exceptions.BenchmarkSetupFailure,
|
||||
sahara_ctx.setup)
|
||||
|
||||
mock_clients_glance.images.get.asser_called_once_with("some_id")
|
||||
mock_glance_create_client.images.get.asser_called_once_with("some_id")
|
||||
|
||||
Reference in New Issue
Block a user