Refactor rally/deploy -> rally/deployment

We should rename this directory to be consistent in naming
and "deploy" is verb which causes misunderstanding...

There are already few places where deployment is used:

1) "rally deployment" command and
2) https://github.com/openstack/rally/blob/master/rally/cli/commands/deployment.py
3) https://github.com/openstack/rally/blob/master/rally/objects/deploy.py#L22
4) https://github.com/openstack/rally/blob/master/rally/db/sqlalchemy/models.py#L55

and we should continue this work and use always "deployment"

Change-Id: I0cdf01a80658288f55258587a7704ce0eb47d532
This commit is contained in:
Kiran 2015-07-01 11:55:14 +05:30 committed by Boris Pavlovic
parent a68bec66a8
commit a50cdaf2d6
47 changed files with 93 additions and 84 deletions

View File

@ -24,7 +24,7 @@ import jsonschema
from rally.common.i18n import _ from rally.common.i18n import _
from rally.common import log as logging from rally.common import log as logging
from rally import consts from rally import consts
from rally.deploy import engine as deploy_engine from rally.deployment import engine as deploy_engine
from rally import exceptions from rally import exceptions
from rally import objects from rally import objects
from rally.task import engine from rally.task import engine

View File

@ -52,8 +52,8 @@ from __future__ import print_function
from rally.cli import cliutils from rally.cli import cliutils
from rally.common.plugin import discover from rally.common.plugin import discover
from rally.common import utils from rally.common import utils
from rally.deploy import engine from rally.deployment import engine
from rally.deploy.serverprovider import provider from rally.deployment.serverprovider import provider
from rally import exceptions from rally import exceptions
from rally.task.scenarios import base as scenario_base from rally.task.scenarios import base as scenario_base
from rally.task import sla from rally.task import sla

View File

@ -45,7 +45,7 @@ def itersubclasses(cls, seen=None):
def import_modules_from_package(package): def import_modules_from_package(package):
"""Import modules from package and append into sys.modules """Import modules from package and append into sys.modules
:param: package - Full package name. For example: rally.deploy.engines :param: package - Full package name. For example: rally.deployment.engines
""" """
path = [os.path.dirname(rally.__file__), ".."] + package.split(".") path = [os.path.dirname(rally.__file__), ".."] + package.split(".")
path = os.path.join(*path) path = os.path.join(*path)

View File

@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from rally.deploy.engine import * # noqa from rally.deployment.engine import * # noqa
from rally.common.plugin import discover from rally.common.plugin import discover
discover.import_modules_from_package("rally.deploy.engines") discover.import_modules_from_package("rally.deployment.engines")
discover.import_modules_from_package("rally.deploy.serverprovider") discover.import_modules_from_package("rally.deployment.serverprovider")

View File

@ -23,7 +23,7 @@ from rally.common import log as logging
from rally.common.plugin import plugin from rally.common.plugin import plugin
from rally.common import utils from rally.common import utils
from rally import consts from rally import consts
from rally.deploy.serverprovider import provider from rally.deployment.serverprovider import provider
from rally import exceptions from rally import exceptions
@ -45,7 +45,7 @@ class EngineFactory(plugin.Plugin):
It's a base class with self-discovery of subclasses. Each subclass It's a base class with self-discovery of subclasses. Each subclass
has to implement deploy() and cleanup() methods. By default, each engine has to implement deploy() and cleanup() methods. By default, each engine
located as a submodule of the package rally.deploy.engines is located as a submodule of the package rally.deployment.engines is
auto-discovered. auto-discovered.
Example of usage with a simple engine: Example of usage with a simple engine:

View File

@ -21,8 +21,8 @@ from rally.common.i18n import _
from rally.common import log as logging from rally.common import log as logging
from rally.common import utils from rally.common import utils
from rally import consts from rally import consts
from rally.deploy import engine from rally.deployment import engine
from rally.deploy.serverprovider import provider from rally.deployment.serverprovider import provider
from rally import objects from rally import objects

View File

@ -14,7 +14,7 @@
# under the License. # under the License.
from rally import consts from rally import consts
from rally.deploy import engine from rally.deployment import engine
from rally import objects from rally import objects

View File

@ -15,8 +15,8 @@
from rally.common.i18n import _ from rally.common.i18n import _
from rally import consts from rally import consts
from rally.deploy import engine from rally.deployment import engine
from rally.deploy.fuel import fuelclient from rally.deployment.fuel import fuelclient
from rally import exceptions from rally import exceptions
from rally import objects from rally import objects

View File

@ -21,9 +21,9 @@ import six
from rally.common.i18n import _ from rally.common.i18n import _
from rally.common import log as logging from rally.common import log as logging
from rally.common import utils from rally.common import utils
from rally.deploy import engine from rally.deployment import engine
from rally.deploy.serverprovider import provider from rally.deployment.serverprovider import provider
from rally.deploy.serverprovider.providers import lxc from rally.deployment.serverprovider.providers import lxc
from rally import exceptions from rally import exceptions
from rally import objects from rally import objects

View File

@ -20,7 +20,7 @@ from six.moves.urllib import parse
import rally import rally
from rally import consts from rally import consts
from rally import db from rally import db
from rally.deploy import engine from rally.deployment import engine
from rally import objects from rally import objects

View File

@ -103,7 +103,7 @@ class ProviderFactory(plugin.Plugin):
It's a base class with self-discovery of subclasses. Each subclass It's a base class with self-discovery of subclasses. Each subclass
has to implement create_servers() and destroy_servers() methods. has to implement create_servers() and destroy_servers() methods.
By default, each server provider located as a submodule of the package By default, each server provider located as a submodule of the package
rally.deploy.serverprovider.providers is auto-discovered. rally.deployment.serverprovider.providers is auto-discovered.
Each provider supervises its own resources using a ResourceManager. Each provider supervises its own resources using a ResourceManager.

View File

@ -14,7 +14,7 @@
# under the License. # under the License.
from rally.deploy.serverprovider import provider from rally.deployment.serverprovider import provider
@provider.configure(name="ExistingServers") @provider.configure(name="ExistingServers")

View File

@ -24,7 +24,7 @@ from six import moves
from rally.common.i18n import _ from rally.common.i18n import _
from rally.common import log as logging from rally.common import log as logging
from rally.common import utils from rally.common import utils
from rally.deploy.serverprovider import provider from rally.deployment.serverprovider import provider
from rally import exceptions from rally import exceptions

View File

@ -20,7 +20,7 @@ import novaclient.exceptions
from rally.common.i18n import _ from rally.common.i18n import _
from rally.common import log as logging from rally.common import log as logging
from rally.deploy.serverprovider import provider from rally.deployment.serverprovider import provider
from rally import exceptions from rally import exceptions
from rally import objects from rally import objects
from rally import osclients from rally import osclients

View File

@ -20,7 +20,7 @@ import uuid
import netaddr import netaddr
from rally.deploy.serverprovider import provider from rally.deployment.serverprovider import provider
@provider.configure(name="VirshProvider") @provider.configure(name="VirshProvider")

View File

@ -16,10 +16,11 @@
import mock import mock
from rally.cli.commands import info from rally.cli.commands import info
from rally.deploy import engine from rally.deployment import engine
from rally.deploy.engines import existing as existing_cloud from rally.deployment.engines import existing as existing_cloud
from rally.deploy.serverprovider import provider from rally.deployment.serverprovider import provider
from rally.deploy.serverprovider.providers import existing as existing_servers from rally.deployment.serverprovider.providers import (
existing as existing_servers)
from rally import exceptions from rally import exceptions
from rally.plugins.common.scenarios.dummy import dummy from rally.plugins.common.scenarios.dummy import dummy
from rally.plugins.common.sla import failure_rate from rally.plugins.common.sla import failure_rate

View File

@ -16,7 +16,7 @@
import jsonschema import jsonschema
import mock import mock
from rally.deploy.engines import devstack from rally.deployment.engines import devstack
from tests.unit import test from tests.unit import test
@ -54,7 +54,7 @@ class DevstackEngineTestCase(test.TestCase):
def test_construct(self): def test_construct(self):
self.assertEqual(self.engine.localrc["ADMIN_PASSWORD"], "secret") self.assertEqual(self.engine.localrc["ADMIN_PASSWORD"], "secret")
@mock.patch("rally.deploy.engines.devstack.open", create=True) @mock.patch("rally.deployment.engines.devstack.open", create=True)
def test_prepare_server(self, mock_open): def test_prepare_server(self, mock_open):
mock_open.return_value = "fake_file" mock_open.return_value = "fake_file"
server = mock.Mock() server = mock.Mock()
@ -66,15 +66,15 @@ class DevstackEngineTestCase(test.TestCase):
] ]
self.assertEqual(calls, server.ssh.run.mock_calls) self.assertEqual(calls, server.ssh.run.mock_calls)
filename = mock_open.mock_calls[0][1][0] filename = mock_open.mock_calls[0][1][0]
self.assertTrue(filename.endswith("rally/deploy/engines/" self.assertTrue(filename.endswith("rally/deployment/engines/"
"devstack/install.sh")) "devstack/install.sh"))
self.assertEqual([mock.call(filename, "rb")], mock_open.mock_calls) self.assertEqual([mock.call(filename, "rb")], mock_open.mock_calls)
@mock.patch("rally.deploy.engine.EngineFactory.get_provider") @mock.patch("rally.deployment.engine.EngineFactory.get_provider")
@mock.patch("rally.deploy.engines.devstack.get_updated_server") @mock.patch("rally.deployment.engines.devstack.get_updated_server")
@mock.patch("rally.deploy.engines.devstack.get_script") @mock.patch("rally.deployment.engines.devstack.get_script")
@mock.patch("rally.deploy.serverprovider.provider.Server") @mock.patch("rally.deployment.serverprovider.provider.Server")
@mock.patch("rally.deploy.engines.devstack.objects.Endpoint") @mock.patch("rally.deployment.engines.devstack.objects.Endpoint")
def test_deploy(self, mock_endpoint, mock_server, mock_get_script, def test_deploy(self, mock_endpoint, mock_server, mock_get_script,
mock_get_updated_server, mock_engine_factory_get_provider): mock_get_updated_server, mock_engine_factory_get_provider):
mock_engine_factory_get_provider.return_value = fake_provider = ( mock_engine_factory_get_provider.return_value = fake_provider = (

View File

@ -18,8 +18,8 @@
import jsonschema import jsonschema
from rally import consts from rally import consts
from rally.deploy import engine as deploy_engine from rally.deployment import engine as deploy_engine
from rally.deploy.engines import existing from rally.deployment.engines import existing
from tests.unit import test from tests.unit import test

View File

@ -14,7 +14,7 @@
# under the License. # under the License.
from rally import consts from rally import consts
from rally.deploy.engines import fuel from rally.deployment.engines import fuel
from rally import exceptions from rally import exceptions
from tests.unit import fakes from tests.unit import fakes
from tests.unit import test from tests.unit import test
@ -83,8 +83,8 @@ class FuelEngineTestCase(test.TestCase):
engine.client.get_releases = mock.Mock(return_value=fake_releases) engine.client.get_releases = mock.Mock(return_value=fake_releases)
self.assertEqual(42, engine._get_release_id()) self.assertEqual(42, engine._get_release_id())
@mock.patch("rally.deploy.fuel.fuelclient.FuelClient") @mock.patch("rally.deployment.fuel.fuelclient.FuelClient")
@mock.patch("rally.deploy.fuel.fuelclient.FuelCluster") @mock.patch("rally.deployment.fuel.fuelclient.FuelCluster")
def test_deploy(self, mock_fuel_cluster, mock_fuel_client): def test_deploy(self, mock_fuel_cluster, mock_fuel_client):
attributes = {"editable": {"access": {"user": {"value": "user"}, attributes = {"editable": {"access": {"user": {"value": "user"},
"password": {"value": "pw"}, "password": {"value": "pw"},
@ -129,8 +129,8 @@ class FuelEngineTestCase(test.TestCase):
self.assertEqual(expected_cluster_calls, cluster.mock_calls) self.assertEqual(expected_cluster_calls, cluster.mock_calls)
self.assertEqual([mock.call.get_nodes()], client.mock_calls) self.assertEqual([mock.call.get_nodes()], client.mock_calls)
@mock.patch("rally.deploy.fuel.fuelclient.FuelClient") @mock.patch("rally.deployment.fuel.fuelclient.FuelClient")
@mock.patch("rally.deploy.engines.fuel.objects.Deployment") @mock.patch("rally.deployment.engines.fuel.objects.Deployment")
def test_cleanup(self, mock_deployment, mock_fuel_client): def test_cleanup(self, mock_deployment, mock_fuel_client):
fake_resources = [{"id": 41, "info": {"id": 42}}] fake_resources = [{"id": 41, "info": {"id": 42}}]
self.deployment.get_resources = mock.Mock(return_value=fake_resources) self.deployment.get_resources = mock.Mock(return_value=fake_resources)

View File

@ -15,8 +15,8 @@
import jsonschema import jsonschema
from rally.deploy.serverprovider import provider from rally.deployment.serverprovider import provider
from rally.deploy.serverprovider.providers import existing from rally.deployment.serverprovider.providers import existing
from tests.unit import test from tests.unit import test

View File

@ -17,12 +17,12 @@ import jsonschema
import mock import mock
import netaddr import netaddr
from rally.deploy.serverprovider.providers import lxc from rally.deployment.serverprovider.providers import lxc
from rally import exceptions from rally import exceptions
from tests.unit import test from tests.unit import test
MOD_NAME = "rally.deploy.serverprovider.providers.lxc." MOD_NAME = "rally.deployment.serverprovider.providers.lxc."
class HelperFunctionsTestCase(test.TestCase): class HelperFunctionsTestCase(test.TestCase):
@ -33,8 +33,8 @@ class HelperFunctionsTestCase(test.TestCase):
self.assertEqual("fake_script", script) self.assertEqual("fake_script", script)
path = mock_open.mock_calls[0][1][0] path = mock_open.mock_calls[0][1][0]
mode = mock_open.mock_calls[0][1][1] mode = mock_open.mock_calls[0][1][1]
self.assertTrue(path.endswith("rally/deploy/serverprovider/providers" self.assertTrue(path.endswith(
"/lxc/script.sh")) "rally/deployment/serverprovider/providers/lxc/script.sh"))
self.assertEqual("rb", mode) self.assertEqual("rb", mode)
@mock.patch(MOD_NAME + "_get_script", return_value="fake_script") @mock.patch(MOD_NAME + "_get_script", return_value="fake_script")

View File

@ -19,12 +19,12 @@ import jsonschema
import mock import mock
from oslotest import mockpatch from oslotest import mockpatch
from rally.deploy.serverprovider.providers import openstack as provider from rally.deployment.serverprovider.providers import openstack as provider
from rally import exceptions from rally import exceptions
from tests.unit import fakes from tests.unit import fakes
from tests.unit import test from tests.unit import test
MOD_NAME = "rally.deploy.serverprovider.providers.openstack" MOD_NAME = "rally.deployment.serverprovider.providers.openstack"
OSProvider = provider.OpenStackProvider OSProvider = provider.OpenStackProvider
@ -41,8 +41,8 @@ class OpenStackProviderTestCase(test.TestCase):
def setUp(self): def setUp(self):
super(OpenStackProviderTestCase, self).setUp() super(OpenStackProviderTestCase, self).setUp()
self.useFixture(mockpatch.Patch("rally.deploy.serverprovider.provider." self.useFixture(mockpatch.Patch(
"ResourceManager")) "rally.deployment.serverprovider.provider.ResourceManager"))
def _get_valid_config(self): def _get_valid_config(self):
return { return {
@ -80,7 +80,8 @@ class OpenStackProviderTestCase(test.TestCase):
self.clients.nova = mock.MagicMock(return_value=self.nova_client) self.clients.nova = mock.MagicMock(return_value=self.nova_client)
@mock.patch("rally.deploy.serverprovider.providers.openstack.osclients") @mock.patch(
"rally.deployment.serverprovider.providers.openstack.osclients")
def test_openstack_provider_init(self, mock_osclients): def test_openstack_provider_init(self, mock_osclients):
cfg = self._get_valid_config() cfg = self._get_valid_config()
mock_osclients.Clients = mock.MagicMock(return_value=FakeOSClients()) mock_osclients.Clients = mock.MagicMock(return_value=FakeOSClients())
@ -95,7 +96,8 @@ class OpenStackProviderTestCase(test.TestCase):
provider = OSProvider(mock.MagicMock(), cfg) provider = OSProvider(mock.MagicMock(), cfg)
self.assertIsNone(provider.glance) self.assertIsNone(provider.glance)
@mock.patch("rally.deploy.serverprovider.providers.openstack.osclients") @mock.patch(
"rally.deployment.serverprovider.providers.openstack.osclients")
def test_openstack_provider_init_with_invalid_conf_no_user(self, def test_openstack_provider_init_with_invalid_conf_no_user(self,
mock_osclients): mock_osclients):
cfg = self._get_valid_config() cfg = self._get_valid_config()
@ -103,7 +105,8 @@ class OpenStackProviderTestCase(test.TestCase):
self.assertRaises(jsonschema.ValidationError, OSProvider, self.assertRaises(jsonschema.ValidationError, OSProvider,
mock.MagicMock(), cfg) mock.MagicMock(), cfg)
@mock.patch("rally.deploy.serverprovider.providers.openstack.osclients") @mock.patch(
"rally.deployment.serverprovider.providers.openstack.osclients")
def test_openstack_provider_init_with_invalid_conf_no_url(self, def test_openstack_provider_init_with_invalid_conf_no_url(self,
mock_osclients): mock_osclients):
cfg = self._get_valid_config() cfg = self._get_valid_config()
@ -112,7 +115,8 @@ class OpenStackProviderTestCase(test.TestCase):
self.assertRaises(jsonschema.ValidationError, OSProvider, self.assertRaises(jsonschema.ValidationError, OSProvider,
mock.MagicMock(), cfg) mock.MagicMock(), cfg)
@mock.patch("rally.deploy.serverprovider.providers.openstack.osclients") @mock.patch(
"rally.deployment.serverprovider.providers.openstack.osclients")
def test_openstack_provider_init_with_invalid_conf_extra_key( def test_openstack_provider_init_with_invalid_conf_extra_key(
self, mock_osclients): self, mock_osclients):
cfg = self._get_valid_config() cfg = self._get_valid_config()
@ -120,26 +124,30 @@ class OpenStackProviderTestCase(test.TestCase):
self.assertRaises(jsonschema.ValidationError, OSProvider, self.assertRaises(jsonschema.ValidationError, OSProvider,
mock.MagicMock(), cfg) mock.MagicMock(), cfg)
@mock.patch("rally.deploy.serverprovider.providers.openstack.osclients") @mock.patch(
"rally.deployment.serverprovider.providers.openstack.osclients")
def test_openstack_provider_init_with_invalid_conf_flavor_(self, def test_openstack_provider_init_with_invalid_conf_flavor_(self,
mock_osclients): mock_osclients):
cfg = self._get_valid_config()["user"] = 1111 cfg = self._get_valid_config()["user"] = 1111
self.assertRaises(jsonschema.ValidationError, OSProvider, self.assertRaises(jsonschema.ValidationError, OSProvider,
mock.MagicMock(), cfg) mock.MagicMock(), cfg)
@mock.patch("rally.deploy.serverprovider.providers.openstack.osclients") @mock.patch(
"rally.deployment.serverprovider.providers.openstack.osclients")
def test_openstack_provider_with_valid_config(self, def test_openstack_provider_with_valid_config(self,
mock_osclients): mock_osclients):
cfg = self._get_valid_config() cfg = self._get_valid_config()
OSProvider(mock.MagicMock(), cfg) OSProvider(mock.MagicMock(), cfg)
@mock.patch("rally.deploy.serverprovider.providers.openstack.osclients") @mock.patch(
"rally.deployment.serverprovider.providers.openstack.osclients")
def test_openstack_provider_with_valid_config_uuid(self, mock_osclients): def test_openstack_provider_with_valid_config_uuid(self, mock_osclients):
cfg = self._get_valid_config() cfg = self._get_valid_config()
cfg["image"] = dict(uuid="289D7A51-1A0C-43C4-800D-706EA8A3CDF3") cfg["image"] = dict(uuid="289D7A51-1A0C-43C4-800D-706EA8A3CDF3")
OSProvider(mock.MagicMock(), cfg) OSProvider(mock.MagicMock(), cfg)
@mock.patch("rally.deploy.serverprovider.providers.openstack.osclients") @mock.patch(
"rally.deployment.serverprovider.providers.openstack.osclients")
def test_openstack_provider_with_valid_config_checksum(self, def test_openstack_provider_with_valid_config_checksum(self,
mock_osclients): mock_osclients):
cfg = self._get_valid_config() cfg = self._get_valid_config()

View File

@ -20,7 +20,7 @@ import mock
import netaddr import netaddr
from oslotest import mockpatch from oslotest import mockpatch
from rally.deploy.serverprovider.providers import virsh from rally.deployment.serverprovider.providers import virsh
from tests.unit import test from tests.unit import test
@ -39,8 +39,8 @@ class VirshProviderTestCase(test.TestCase):
self.useFixture(mockpatch.PatchObject(self.provider, "resources")) self.useFixture(mockpatch.PatchObject(self.provider, "resources"))
@mock.patch( @mock.patch(
"rally.deploy.serverprovider.providers.virsh.netaddr.IPAddress") "rally.deployment.serverprovider.providers.virsh.netaddr.IPAddress")
@mock.patch("rally.deploy.serverprovider.providers.virsh.subprocess") @mock.patch("rally.deployment.serverprovider.providers.virsh.subprocess")
@mock.patch("time.sleep") @mock.patch("time.sleep")
def test_create_vm(self, mock_sleep, mock_subprocess, mock_ip_address): def test_create_vm(self, mock_sleep, mock_subprocess, mock_ip_address):
mock_subprocess.check_output.return_value = "10.0.0.1" mock_subprocess.check_output.return_value = "10.0.0.1"
@ -70,8 +70,8 @@ class VirshProviderTestCase(test.TestCase):
}) })
@mock.patch( @mock.patch(
"rally.deploy.serverprovider.providers.virsh.netaddr.IPAddress") "rally.deployment.serverprovider.providers.virsh.netaddr.IPAddress")
@mock.patch("rally.deploy.serverprovider.providers.virsh.subprocess") @mock.patch("rally.deployment.serverprovider.providers.virsh.subprocess")
@mock.patch("time.sleep") @mock.patch("time.sleep")
def test_create_vm_ip_failed(self, mock_sleep, mock_subprocess, def test_create_vm_ip_failed(self, mock_sleep, mock_subprocess,
mock_ip_address): mock_ip_address):
@ -83,7 +83,7 @@ class VirshProviderTestCase(test.TestCase):
]) ])
self.assertEqual(server.host, "None") self.assertEqual(server.host, "None")
@mock.patch("rally.deploy.serverprovider.providers.virsh.subprocess") @mock.patch("rally.deployment.serverprovider.providers.virsh.subprocess")
def test_destroy_vm(self, mock_subprocess): def test_destroy_vm(self, mock_subprocess):
self.provider.destroy_vm("uuid") self.provider.destroy_vm("uuid")
mock_subprocess.assert_has_calls([ mock_subprocess.assert_has_calls([
@ -94,7 +94,7 @@ class VirshProviderTestCase(test.TestCase):
shell=True), shell=True),
]) ])
@mock.patch("rally.deploy.serverprovider.providers.virsh.uuid") @mock.patch("rally.deployment.serverprovider.providers.virsh.uuid")
@mock.patch.object(virsh.VirshProvider, "create_vm") @mock.patch.object(virsh.VirshProvider, "create_vm")
def test_create_servers(self, mock_create_vm, mock_uuid): def test_create_servers(self, mock_create_vm, mock_uuid):
mock_uuid.uuid4.side_effect = ["1", "2", "3"] mock_uuid.uuid4.side_effect = ["1", "2", "3"]

View File

@ -18,7 +18,7 @@ import mock
import six import six
from rally.common import sshutils from rally.common import sshutils
from rally.deploy.serverprovider import provider from rally.deployment.serverprovider import provider
from rally import exceptions from rally import exceptions
from tests.unit import test from tests.unit import test

View File

@ -18,7 +18,7 @@
import mock import mock
from rally import consts from rally import consts
from rally.deploy import engine from rally.deployment import engine
from rally import exceptions from rally import exceptions
from tests.unit import test from tests.unit import test

View File

@ -15,11 +15,11 @@
import mock import mock
from rally.deploy import engine from rally.deployment import engine
from rally import objects from rally import objects
from tests.unit import test from tests.unit import test
MOD = "rally.deploy.engines.lxc." MOD = "rally.deployment.engines.lxc."
class LxcEngineTestCase(test.TestCase): class LxcEngineTestCase(test.TestCase):

View File

@ -17,11 +17,11 @@
import mock import mock
from rally import consts from rally import consts
from rally.deploy import engine from rally.deployment import engine
from tests.unit import fakes from tests.unit import fakes
from tests.unit import test from tests.unit import test
MOD = "rally.deploy.engines.multihost." MOD = "rally.deployment.engines.multihost."
class MultihostEngineTestCase(test.TestCase): class MultihostEngineTestCase(test.TestCase):

View File

@ -199,7 +199,7 @@ class BaseDeploymentTestCase(test.TestCase):
class DeploymentAPITestCase(BaseDeploymentTestCase): class DeploymentAPITestCase(BaseDeploymentTestCase):
@mock.patch("rally.objects.deploy.db.deployment_update") @mock.patch("rally.objects.deploy.db.deployment_update")
@mock.patch("rally.objects.deploy.db.deployment_create") @mock.patch("rally.objects.deploy.db.deployment_create")
@mock.patch("rally.deploy.engine.EngineFactory.validate") @mock.patch("rally.deployment.engine.EngineFactory.validate")
def test_create(self, mock_engine_factory_validate, def test_create(self, mock_engine_factory_validate,
mock_deployment_create, mock_deployment_update): mock_deployment_create, mock_deployment_update):
mock_deployment_create.return_value = self.deployment mock_deployment_create.return_value = self.deployment
@ -216,7 +216,7 @@ class DeploymentAPITestCase(BaseDeploymentTestCase):
@mock.patch("rally.objects.deploy.db.deployment_update") @mock.patch("rally.objects.deploy.db.deployment_update")
@mock.patch("rally.objects.deploy.db.deployment_create") @mock.patch("rally.objects.deploy.db.deployment_create")
@mock.patch("rally.deploy.engine.EngineFactory.validate", @mock.patch("rally.deployment.engine.EngineFactory.validate",
side_effect=jsonschema.ValidationError("ValidationError")) side_effect=jsonschema.ValidationError("ValidationError"))
def test_create_validation_error( def test_create_validation_error(
self, mock_engine_factory_validate, mock_deployment_create, self, mock_engine_factory_validate, mock_deployment_create,

View File

@ -15,8 +15,8 @@
from rally.common.plugin import discover from rally.common.plugin import discover
from rally.common import utils from rally.common import utils
from rally.deploy import engine from rally.deployment import engine
from rally.deploy.serverprovider import provider from rally.deployment.serverprovider import provider
from rally.task.scenarios import base from rally.task.scenarios import base
from rally.task import sla from rally.task import sla
from tests.unit import test from tests.unit import test

View File

@ -17,7 +17,7 @@ import copy
import mock import mock
from rally.deploy.fuel import fuelclient from rally.deployment.fuel import fuelclient
from tests.unit import test from tests.unit import test
@ -153,7 +153,7 @@ class FuelClusterTestCase(test.TestCase):
"key": "new_val", "key": "new_val",
"key2": "val2"}]}) "key2": "val2"}]})
@mock.patch("rally.deploy.fuel.fuelclient.time.sleep") @mock.patch("rally.deployment.fuel.fuelclient.time.sleep")
def test_deploy(self, mock_sleep): def test_deploy(self, mock_sleep):
call1 = {"progress": 50} call1 = {"progress": 50}
call2 = {"progress": 100} call2 = {"progress": 100}
@ -189,7 +189,7 @@ class FuelClusterTestCase(test.TestCase):
"clusters/42/network_configuration/nova_network", {"key": "val"}) "clusters/42/network_configuration/nova_network", {"key": "val"})
self.cluster.verify_network.assert_called_once_with({"key": "val"}) self.cluster.verify_network.assert_called_once_with({"key": "val"})
@mock.patch("rally.deploy.fuel.fuelclient.time.sleep") @mock.patch("rally.deployment.fuel.fuelclient.time.sleep")
def test_verify_network(self, mock_sleep): def test_verify_network(self, mock_sleep):
call1 = {"progress": 50} call1 = {"progress": 50}
call2 = {"progress": 100, "message": ""} call2 = {"progress": 100, "message": ""}
@ -206,7 +206,7 @@ class FuelClusterTestCase(test.TestCase):
self.assertEqual([mock.call(42), mock.call(42)], self.assertEqual([mock.call(42), mock.call(42)],
self.client.get_task.mock_calls) self.client.get_task.mock_calls)
@mock.patch("rally.deploy.fuel.fuelclient.time.sleep") @mock.patch("rally.deployment.fuel.fuelclient.time.sleep")
def test_verify_network_fail(self, mock_sleep): def test_verify_network_fail(self, mock_sleep):
self.client.put.return_value = {"id": 42} self.client.put.return_value = {"id": 42}
self.client.get_task.return_value = {"progress": 100, self.client.get_task.return_value = {"progress": 100,
@ -244,7 +244,7 @@ class FuelClientTestCase(test.TestCase):
super(FuelClientTestCase, self).setUp() super(FuelClientTestCase, self).setUp()
self.client = fuelclient.FuelClient("http://10.20.0.2:8000/api/v1/") self.client = fuelclient.FuelClient("http://10.20.0.2:8000/api/v1/")
@mock.patch("rally.deploy.fuel.fuelclient.requests") @mock.patch("rally.deployment.fuel.fuelclient.requests")
def test__request_non_json(self, mock_requests): def test__request_non_json(self, mock_requests):
reply = mock.Mock() reply = mock.Mock()
reply.status_code = 200 reply.status_code = 200
@ -256,7 +256,7 @@ class FuelClientTestCase(test.TestCase):
self.assertEqual(retval, reply) self.assertEqual(retval, reply)
@mock.patch("rally.deploy.fuel.fuelclient.requests") @mock.patch("rally.deployment.fuel.fuelclient.requests")
def test__request_non_2xx(self, mock_requests): def test__request_non_2xx(self, mock_requests):
reply = mock.Mock() reply = mock.Mock()
reply.status_code = 300 reply.status_code = 300
@ -267,7 +267,7 @@ class FuelClientTestCase(test.TestCase):
self.client._request, "method", "url", self.client._request, "method", "url",
data={"key": "value"}) data={"key": "value"})
@mock.patch("rally.deploy.fuel.fuelclient.requests") @mock.patch("rally.deployment.fuel.fuelclient.requests")
def test__request(self, mock_requests): def test__request(self, mock_requests):
reply = mock.Mock() reply = mock.Mock()
reply.status_code = 202 reply.status_code = 202