Use rally.plugins.openstack.osclients import everywhere
Change-Id: Id34d8dc40942b4e29324eae17f0e64c78c5e0c49
This commit is contained in:
parent
4734665d15
commit
04ac4bc0e6
@ -40,7 +40,7 @@ implement the Context API: the *setup()* method that creates a flavor and the
|
||||
from rally.task import context
|
||||
from rally.common import logging
|
||||
from rally import consts
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack import osclients
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -887,7 +887,7 @@ VerifierContext
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.task import context
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@ import random
|
||||
from rally.common import validation
|
||||
from rally import consts
|
||||
from rally import exceptions
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.task import context
|
||||
|
||||
|
||||
|
@ -16,8 +16,8 @@ from rally.common import logging
|
||||
from rally.common import utils
|
||||
from rally.common import validation
|
||||
from rally import consts
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack.cleanup import manager as resource_manager
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.plugins.openstack.services.storage import block
|
||||
from rally.task import context
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
|
||||
from rally.common import utils as rutils
|
||||
from rally import consts
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack.cleanup import manager as resource_manager
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.plugins.openstack.services.storage import block
|
||||
from rally.task import context
|
||||
|
||||
|
@ -19,8 +19,8 @@ from rally.common import utils as rutils
|
||||
from rally.common import validation
|
||||
from rally import consts
|
||||
from rally import exceptions
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack.cleanup import manager as resource_manager
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.plugins.openstack.scenarios.heat import utils as heat_utils
|
||||
from rally.task import context
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
from rally.common import logging
|
||||
from rally.common import utils as rutils
|
||||
from rally import consts
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack.cleanup import manager as resource_manager
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.plugins.openstack.scenarios.ec2 import utils as ec2_utils
|
||||
from rally.plugins.openstack import types
|
||||
from rally.task import context
|
||||
|
@ -18,8 +18,8 @@ from rally.common import logging
|
||||
from rally.common import utils as rutils
|
||||
from rally.common import validation
|
||||
from rally import consts
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack.cleanup import manager as resource_manager
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.plugins.openstack.services.image import image
|
||||
from rally.task import context
|
||||
|
||||
|
@ -20,7 +20,7 @@ from rally.common import logging
|
||||
from rally.common import validation
|
||||
from rally import consts
|
||||
from rally import exceptions
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.plugins.openstack.services.identity import identity
|
||||
from rally.task import context
|
||||
|
||||
|
@ -25,8 +25,8 @@ from rally.common import utils as rutils
|
||||
from rally.common import validation
|
||||
from rally import consts
|
||||
from rally import exceptions
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack import credential
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.plugins.openstack.services.identity import identity
|
||||
from rally.plugins.openstack.wrappers import network
|
||||
from rally.task import context
|
||||
|
@ -21,8 +21,8 @@ from rally.common import utils
|
||||
from rally.common import validation
|
||||
from rally import consts
|
||||
from rally import exceptions
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack.cleanup import manager as resource_manager
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.task import context
|
||||
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
from rally.common import logging
|
||||
from rally.common import utils
|
||||
from rally.common import validation
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.plugins.openstack.wrappers import network
|
||||
from rally.task import context
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
from rally.common import utils
|
||||
from rally.common import validation
|
||||
from rally import consts
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.plugins.openstack.wrappers import network as network_wrapper
|
||||
from rally.task import context
|
||||
|
||||
|
@ -17,7 +17,7 @@ from rally.common import logging
|
||||
from rally.common import utils
|
||||
from rally.common import validation
|
||||
from rally import consts
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.plugins.openstack.wrappers import network as network_wrapper
|
||||
from rally.task import context
|
||||
|
||||
|
@ -14,7 +14,7 @@ from rally.common import logging
|
||||
from rally.common import utils
|
||||
from rally.common import validation
|
||||
from rally import consts
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.plugins.openstack.wrappers import network as network_wrapper
|
||||
from rally.task import context
|
||||
|
||||
|
@ -17,8 +17,8 @@ from rally.common import logging
|
||||
from rally.common import utils as rutils
|
||||
from rally.common import validation
|
||||
from rally import consts
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack.cleanup import manager as resource_manager
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.task import context
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
from rally.common import validation
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack.cleanup import manager as resource_manager
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.task import context
|
||||
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
from rally.common import logging
|
||||
from rally.common import utils as rutils
|
||||
from rally.common import validation
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack.cleanup import manager as resource_manager
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.plugins.openstack.scenarios.nova import utils as nova_utils
|
||||
from rally.plugins.openstack import types
|
||||
from rally.task import context
|
||||
|
@ -16,12 +16,12 @@
|
||||
from rally.common import logging
|
||||
from rally.common import validation
|
||||
from rally import consts
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack.context.quotas import cinder_quotas
|
||||
from rally.plugins.openstack.context.quotas import designate_quotas
|
||||
from rally.plugins.openstack.context.quotas import manila_quotas
|
||||
from rally.plugins.openstack.context.quotas import neutron_quotas
|
||||
from rally.plugins.openstack.context.quotas import nova_quotas
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.task import context
|
||||
|
||||
|
||||
|
@ -16,8 +16,8 @@ from rally.common import utils as rutils
|
||||
from rally.common import validation
|
||||
from rally import consts
|
||||
from rally import exceptions
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack.cleanup import manager as resource_manager
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.plugins.openstack.scenarios.sahara import utils
|
||||
from rally.plugins.openstack.services.image import image as image_services
|
||||
from rally.task import context
|
||||
|
@ -19,8 +19,8 @@ from six.moves.urllib import parse
|
||||
from rally.common import utils as rutils
|
||||
from rally.common import validation
|
||||
from rally import consts
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack.cleanup import manager as resource_manager
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.plugins.openstack.scenarios.sahara import utils
|
||||
from rally.plugins.openstack.scenarios.swift import utils as swift_utils
|
||||
from rally.task import context
|
||||
|
@ -19,8 +19,8 @@ from rally.common import utils as rutils
|
||||
from rally.common import validation
|
||||
from rally import consts
|
||||
from rally import exceptions
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack.cleanup import manager as resource_manager
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.plugins.openstack.scenarios.sahara import utils
|
||||
from rally.task import context
|
||||
|
||||
|
@ -16,8 +16,8 @@
|
||||
from rally.common import utils as rutils
|
||||
from rally.common import validation
|
||||
from rally import consts
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack.cleanup import manager as resource_manager
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.plugins.openstack.scenarios.sahara import utils
|
||||
from rally.plugins.openstack.scenarios.swift import utils as swift_utils
|
||||
from rally.task import context
|
||||
|
@ -21,7 +21,7 @@ from rally.common import broker
|
||||
from rally.common import logging
|
||||
from rally.common import utils
|
||||
from rally import consts
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.plugins.openstack.scenarios.vm import vmtasks
|
||||
from rally.plugins.openstack.services.image import image
|
||||
from rally.plugins.openstack import types
|
||||
|
@ -18,8 +18,8 @@ import six
|
||||
|
||||
from rally.common import validation
|
||||
from rally import consts
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack.cleanup import manager as resource_manager
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.plugins.openstack.scenarios.watcher import utils as watcher_utils
|
||||
from rally.plugins.openstack import types
|
||||
from rally.task import context
|
||||
|
@ -16,7 +16,7 @@
|
||||
from rally.common import logging
|
||||
from rally import consts
|
||||
from rally.deployment import credential
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack import osclients
|
||||
|
||||
LOG = logging.getLogger(__file__)
|
||||
|
||||
|
@ -19,7 +19,7 @@ import random
|
||||
from oslo_config import cfg
|
||||
from osprofiler import profiler
|
||||
from rally.common.plugin import plugin
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.task import context
|
||||
from rally.task import scenario
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.plugins.openstack.services.identity import identity
|
||||
from rally.task import atomic
|
||||
|
||||
|
@ -67,7 +67,7 @@ class NetworkWrapper(object):
|
||||
def __init__(self, clients, owner, config=None):
|
||||
"""Returns available network wrapper instance.
|
||||
|
||||
:param clients: rally.osclients.Clients instance
|
||||
:param clients: rally.plugins.openstack.osclients.Clients instance
|
||||
:param owner: The object that owns resources created by this
|
||||
wrapper instance. It will be used to generate
|
||||
random names, so must implement
|
||||
@ -378,7 +378,7 @@ class NeutronWrapper(NetworkWrapper):
|
||||
def wrap(clients, owner, config=None):
|
||||
"""Returns available network wrapper instance.
|
||||
|
||||
:param clients: rally.osclients.Clients instance
|
||||
:param clients: rally.plugins.openstack.osclients.Clients instance
|
||||
:param owner: The object that owns resources created by this
|
||||
wrapper instance. It will be used to generate random
|
||||
names, so must implement
|
||||
|
@ -65,7 +65,7 @@ class ImageGeneratorTestCase(test.ScenarioTestCase):
|
||||
{"tenants": 3, "users_per_tenant": 2, "images_per_tenant": 5},
|
||||
{"api_versions": {"glance": {"version": 2, "service_type": "image"}}})
|
||||
@ddt.unpack
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
def test_setup(self, mock_clients,
|
||||
container_format="bare", disk_format="qcow2",
|
||||
image_url="http://example.com/fake/url",
|
||||
|
@ -24,8 +24,8 @@ from rally.plugins.openstack.context.manila import consts
|
||||
from rally.plugins.openstack.context.manila import manila_share_networks
|
||||
from tests.unit import test
|
||||
|
||||
MANILA_UTILS_PATH = ("rally.plugins.openstack.scenarios.manila.utils."
|
||||
"ManilaScenario.")
|
||||
MANILA_UTILS_PATH = (
|
||||
"rally.plugins.openstack.scenarios.manila.utils.ManilaScenario.")
|
||||
|
||||
MOCK_USER_CREDENTIAL = mock.MagicMock()
|
||||
|
||||
@ -167,7 +167,7 @@ class ShareNetworksTestCase(test.TestCase):
|
||||
|
||||
self.assertEqual(expected_ctxt, inst.context)
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
@mock.patch(MANILA_UTILS_PATH + "_list_share_networks")
|
||||
def test_setup_use_existing_share_networks(
|
||||
self, mock_manila_scenario__list_share_networks, mock_clients):
|
||||
@ -215,7 +215,7 @@ class ShareNetworksTestCase(test.TestCase):
|
||||
|
||||
self.assertRaises(exceptions.ContextSetupFailure, inst.setup)
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
@mock.patch(MANILA_UTILS_PATH + "_list_share_networks")
|
||||
def test_setup_use_existing_share_networks_sn_not_found(
|
||||
self, mock_manila_scenario__list_share_networks, mock_clients):
|
||||
@ -237,7 +237,7 @@ class ShareNetworksTestCase(test.TestCase):
|
||||
self.assertRaises(exceptions.ContextSetupFailure, inst.setup)
|
||||
|
||||
@ddt.data(True, False)
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
@mock.patch(MANILA_UTILS_PATH + "_create_share_network")
|
||||
@mock.patch(MANILA_UTILS_PATH + "_add_security_service_to_share_network")
|
||||
def test_setup_autocreate_share_networks_with_security_services(
|
||||
@ -295,7 +295,7 @@ class ShareNetworksTestCase(test.TestCase):
|
||||
for i in range(self.TENANTS_AMOUNT)])
|
||||
|
||||
@ddt.data(True, False)
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
@mock.patch(MANILA_UTILS_PATH + "_create_share_network")
|
||||
@mock.patch(MANILA_UTILS_PATH + "_add_security_service_to_share_network")
|
||||
def test_setup_autocreate_share_networks_wo_security_services(
|
||||
@ -332,7 +332,7 @@ class ShareNetworksTestCase(test.TestCase):
|
||||
mock_clients.assert_has_calls([mock.call(MOCK_USER_CREDENTIAL, {})
|
||||
for i in range(self.TENANTS_AMOUNT)])
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
@mock.patch(MANILA_UTILS_PATH + "_create_share_network")
|
||||
@mock.patch(MANILA_UTILS_PATH + "_add_security_service_to_share_network")
|
||||
def test_setup_autocreate_share_networks_wo_networks(
|
||||
@ -357,7 +357,7 @@ class ShareNetworksTestCase(test.TestCase):
|
||||
mock_clients.assert_has_calls([mock.call(MOCK_USER_CREDENTIAL, {})
|
||||
for i in range(self.TENANTS_AMOUNT)])
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
@mock.patch(MANILA_UTILS_PATH + "_delete_share_network")
|
||||
@mock.patch(MANILA_UTILS_PATH + "_list_share_servers")
|
||||
@mock.patch(MANILA_UTILS_PATH + "_list_share_networks")
|
||||
|
@ -37,7 +37,7 @@ class NetworkTestCase(test.TestCase):
|
||||
def test_START_CIDR_DFLT(self):
|
||||
netaddr.IPNetwork(network_context.Network.DEFAULT_CONFIG["start_cidr"])
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
@mock.patch(NET + "wrap", return_value="foo_service")
|
||||
def test__init__default(self, mock_wrap, mock_clients):
|
||||
context = network_context.Network(self.get_context())
|
||||
@ -46,7 +46,7 @@ class NetworkTestCase(test.TestCase):
|
||||
context.config["start_cidr"])
|
||||
self.assertIsNone(context.config["dns_nameservers"])
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
@mock.patch(NET + "wrap", return_value="foo_service")
|
||||
def test__init__explicit(self, mock_wrap, mock_clients):
|
||||
context = network_context.Network(
|
||||
@ -66,7 +66,7 @@ class NetworkTestCase(test.TestCase):
|
||||
@ddt.unpack
|
||||
@mock.patch(NET + "wrap")
|
||||
@mock.patch("rally.plugins.openstack.context.network.networks.utils")
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
def test_setup(self, mock_clients, mock_utils, mock_wrap, **dns_kwargs):
|
||||
mock_utils.iterate_per_tenants.return_value = [
|
||||
("foo_user", "foo_tenant"),
|
||||
@ -102,7 +102,7 @@ class NetworkTestCase(test.TestCase):
|
||||
self.assertSequenceEqual(sorted(expected_networks),
|
||||
sorted(actual_networks))
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
@mock.patch(NET + "wrap")
|
||||
def test_cleanup(self, mock_wrap, mock_clients):
|
||||
net_context = network_context.Network(self.get_context())
|
||||
|
@ -45,7 +45,7 @@ class ExistingNetworkTestCase(test.TestCase):
|
||||
},
|
||||
})
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.wrappers.network.wrap")
|
||||
def test_setup(self, mock_network_wrap, mock_clients):
|
||||
networks = [mock.Mock(), mock.Mock(), mock.Mock()]
|
||||
|
@ -34,7 +34,7 @@ class LbaasTestCase(test.TestCase):
|
||||
"tenants": {"foo_tenant": foo_tenant,
|
||||
"bar_tenant": bar_tenant}}
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
@mock.patch(NET + "wrap", return_value="foo_service")
|
||||
def test__init__default(self, mock_wrap, mock_clients):
|
||||
context = lbaas_context.Lbaas(self.get_context())
|
||||
@ -48,7 +48,7 @@ class LbaasTestCase(test.TestCase):
|
||||
context.config["lbaas_version"],
|
||||
lbaas_context.Lbaas.DEFAULT_CONFIG["lbaas_version"])
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
@mock.patch(NET + "wrap", return_value="foo_service")
|
||||
def test__init__explicit(self, mock_wrap, mock_clients):
|
||||
context = lbaas_context.Lbaas(
|
||||
@ -58,7 +58,7 @@ class LbaasTestCase(test.TestCase):
|
||||
|
||||
@mock.patch(NET + "wrap")
|
||||
@mock.patch("rally.plugins.openstack.context.neutron.lbaas.utils")
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
def test_setup_with_lbaas(self, mock_clients, mock_utils, mock_wrap):
|
||||
mock_utils.iterate_per_tenants.return_value = [
|
||||
("foo_user", "foo_tenant"),
|
||||
@ -96,7 +96,7 @@ class LbaasTestCase(test.TestCase):
|
||||
|
||||
@mock.patch(NET + "wrap")
|
||||
@mock.patch("rally.plugins.openstack.context.neutron.lbaas.utils")
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
def test_setup_with_no_lbaas(self, mock_clients, mock_utils, mock_wrap):
|
||||
mock_utils.iterate_per_tenants.return_value = [
|
||||
("bar_user", "bar_tenant")]
|
||||
@ -113,7 +113,7 @@ class LbaasTestCase(test.TestCase):
|
||||
|
||||
@mock.patch(NET + "wrap")
|
||||
@mock.patch("rally.plugins.openstack.context.neutron.lbaas.utils")
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
def test_setup_with_lbaas_version_not_one(self, mock_clients,
|
||||
mock_utils, mock_wrap):
|
||||
mock_utils.iterate_per_tenants.return_value = [
|
||||
@ -126,7 +126,7 @@ class LbaasTestCase(test.TestCase):
|
||||
net_wrapper.supports_extension.return_value = (True, None)
|
||||
self.assertRaises(NotImplementedError, lb_context.setup)
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
@mock.patch(NET + "wrap")
|
||||
def test_cleanup(self, mock_wrap, mock_clients):
|
||||
net_wrapper = mock_wrap(mock_clients.return_value)
|
||||
@ -143,7 +143,7 @@ class LbaasTestCase(test.TestCase):
|
||||
net_wrapper.delete_v1_pool.assert_has_calls(
|
||||
[mock.call(pool["pool"]["id"]) for pool in expected_pools])
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
@mock.patch(NET + "wrap")
|
||||
def test_cleanup_lbaas_version_not_one(self, mock_wrap, mock_clients):
|
||||
fakeargs = {"lbaas_version": 2}
|
||||
|
@ -78,7 +78,7 @@ class KeyPairContextTestCase(test.TestCase):
|
||||
superclass=keypairs.Keypair,
|
||||
task_id=self.ctx_with_keys["task"]["uuid"])
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
def test_keypair_generate(self, mock_clients):
|
||||
mock_keypairs = mock_clients.return_value.nova.return_value.keypairs
|
||||
mock_keypair = mock_keypairs.create.return_value
|
||||
|
@ -87,7 +87,7 @@ class SaharaImageTestCase(test.ScenarioTestCase):
|
||||
@mock.patch("rally.plugins.openstack.services."
|
||||
"image.image.Image")
|
||||
@mock.patch("%s.resource_manager.cleanup" % CTX)
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
def test_setup_and_cleanup_url_image(self, mock_clients,
|
||||
mock_cleanup, mock_image):
|
||||
|
||||
|
@ -22,7 +22,7 @@ from tests.unit import test
|
||||
|
||||
class SwiftObjectGeneratorTestCase(test.TestCase):
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
def test_setup(self, mock_clients):
|
||||
containers_per_tenant = 2
|
||||
objects_per_container = 7
|
||||
@ -64,7 +64,7 @@ class SwiftObjectGeneratorTestCase(test.TestCase):
|
||||
self.assertEqual(objects_per_container,
|
||||
len(container["objects"]))
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.context.swift.utils."
|
||||
"swift_utils.SwiftScenario")
|
||||
def test_cleanup(self, mock_swift_scenario, mock_clients):
|
||||
@ -114,7 +114,7 @@ class SwiftObjectGeneratorTestCase(test.TestCase):
|
||||
self.assertEqual(0,
|
||||
len(context["tenants"][tenant_id]["containers"]))
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
def test_setup_failure_clients_put_container(self, mock_clients):
|
||||
context = test.get_test_context()
|
||||
context.update({
|
||||
@ -150,7 +150,7 @@ class SwiftObjectGeneratorTestCase(test.TestCase):
|
||||
"containers, expected 4 but got 1",
|
||||
objects_ctx.setup)
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
def test_setup_failure_clients_put_object(self, mock_clients):
|
||||
context = test.get_test_context()
|
||||
context.update({
|
||||
@ -178,7 +178,7 @@ class SwiftObjectGeneratorTestCase(test.TestCase):
|
||||
"objects, expected 2 but got 1",
|
||||
objects_ctx.setup)
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
def test_cleanup_failure_clients_delete_container(self, mock_clients):
|
||||
context = test.get_test_context()
|
||||
context.update({
|
||||
@ -199,7 +199,7 @@ class SwiftObjectGeneratorTestCase(test.TestCase):
|
||||
objects_ctx.cleanup()
|
||||
self.assertEqual(1, len(context["tenants"]["t1"]["containers"]))
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
def test_cleanup_failure_clients_delete_object(self, mock_clients):
|
||||
context = test.get_test_context()
|
||||
context.update({
|
||||
|
@ -21,7 +21,7 @@ from tests.unit import test
|
||||
|
||||
class SwiftObjectMixinTestCase(test.TestCase):
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
def test__create_containers(self, mock_clients):
|
||||
tenants = 2
|
||||
containers_per_tenant = 2
|
||||
@ -56,7 +56,7 @@ class SwiftObjectMixinTestCase(test.TestCase):
|
||||
container["user"]["credential"])
|
||||
self.assertEqual(0, len(container["objects"]))
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
def test__create_objects(self, mock_clients):
|
||||
tenants = 2
|
||||
containers_per_tenant = 1
|
||||
@ -105,7 +105,7 @@ class SwiftObjectMixinTestCase(test.TestCase):
|
||||
self.assertEqual(objects_per_container,
|
||||
len(container["objects"]))
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
def test__delete_containers(self, mock_clients):
|
||||
context = test.get_test_context()
|
||||
context.update({
|
||||
@ -145,7 +145,7 @@ class SwiftObjectMixinTestCase(test.TestCase):
|
||||
self.assertEqual(0,
|
||||
len(context["tenants"][tenant_id]["containers"]))
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
def test__delete_objects(self, mock_clients):
|
||||
context = test.get_test_context()
|
||||
context.update({
|
||||
|
@ -25,7 +25,8 @@ class OpenStackServicesTestCase(test.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(OpenStackServicesTestCase, self).setUp()
|
||||
self.mock_clients = mock.patch("rally.osclients.Clients").start()
|
||||
self.mock_clients = mock.patch(
|
||||
"rally.plugins.openstack.osclients.Clients").start()
|
||||
osclient_kc = self.mock_clients.return_value.keystone
|
||||
self.mock_kc = osclient_kc.return_value
|
||||
self.service_catalog = osclient_kc.service_catalog
|
||||
|
@ -17,7 +17,7 @@ import mock
|
||||
from oslo_config import cfg
|
||||
|
||||
from rally import exceptions
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.plugins.openstack.scenarios.cinder import utils
|
||||
from tests.unit import fakes
|
||||
from tests.unit import test
|
||||
|
@ -265,7 +265,7 @@ class KeystoneMixinTestCase(test.TestCase):
|
||||
self.kc.ec2.delete.assert_called_once_with(user_id=user_id,
|
||||
access=access)
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
def test_fetch_token(self, mock_clients):
|
||||
expected_token = mock_clients.return_value.keystone.auth_ref.auth_token
|
||||
self.assertEqual(expected_token, self.service.fetch_token())
|
||||
|
@ -48,14 +48,14 @@ class OpenStackCredentialTestCase(test.TestCase):
|
||||
"profiler_hmac_key": None},
|
||||
self.credential.to_dict())
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
def test_verify_connection_admin(self, mock_clients):
|
||||
self.credential.verify_connection()
|
||||
mock_clients.assert_called_once_with(
|
||||
self.credential, api_info=None, cache={})
|
||||
mock_clients.return_value.verified_keystone.assert_called_once_with()
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
def test_verify_connection_user(self, mock_clients):
|
||||
self.credential.permission = consts.EndpointPermission.USER
|
||||
self.credential.verify_connection()
|
||||
@ -63,7 +63,7 @@ class OpenStackCredentialTestCase(test.TestCase):
|
||||
self.credential, api_info=None, cache={})
|
||||
mock_clients.return_value.keystone.assert_called_once_with()
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
def test_list_services(self, mock_clients):
|
||||
mock_clients.return_value.services.return_value = {"compute": "nova",
|
||||
"volume": "cinder"}
|
||||
@ -74,7 +74,7 @@ class OpenStackCredentialTestCase(test.TestCase):
|
||||
self.assertEqual([{"name": "cinder", "type": "volume"},
|
||||
{"name": "nova", "type": "compute"}], result)
|
||||
|
||||
@mock.patch("rally.osclients.Clients")
|
||||
@mock.patch("rally.plugins.openstack.osclients.Clients")
|
||||
def test_clients(self, mock_clients):
|
||||
clients = self.credential.clients(api_info="fake_info")
|
||||
mock_clients.assert_called_once_with(
|
||||
|
@ -19,8 +19,8 @@ from oslo_config import cfg
|
||||
|
||||
from rally import consts
|
||||
from rally import exceptions
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack import credential as oscredential
|
||||
from rally.plugins.openstack import osclients
|
||||
from tests.unit import fakes
|
||||
from tests.unit import test
|
||||
|
||||
|
@ -37,7 +37,8 @@ CREDENTIAL_WITH_HMAC = OpenStackCredential(
|
||||
class OpenStackScenarioTestCase(test.TestCase):
|
||||
def setUp(self):
|
||||
super(OpenStackScenarioTestCase, self).setUp()
|
||||
self.osclients = fixtures.MockPatch("rally.osclients.Clients")
|
||||
self.osclients = fixtures.MockPatch(
|
||||
"rally.plugins.openstack.osclients.Clients")
|
||||
self.useFixture(self.osclients)
|
||||
self.context = test.get_test_context()
|
||||
self.context.update({"foo": "bar"})
|
||||
|
@ -17,7 +17,7 @@ import ddt
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack import osclients
|
||||
from rally.plugins.openstack.verification.tempest import config
|
||||
from tests.unit import fakes
|
||||
from tests.unit import test
|
||||
|
@ -192,7 +192,7 @@ class ContextTestCase(ScenarioTestCase):
|
||||
def get_client_mocks(self):
|
||||
return [
|
||||
mock.patch(
|
||||
"rally.osclients.Clients",
|
||||
"rally.plugins.openstack.osclients.Clients",
|
||||
mock.Mock(side_effect=self.context_client))
|
||||
]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user