Merge "Delete depracated types stuff from Rally"
This commit is contained in:
commit
d81cb30d98
@ -19,8 +19,8 @@ from rally import consts
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack.cleanup import manager as resource_manager
|
||||
from rally.plugins.openstack.scenarios.ec2 import utils as ec2_utils
|
||||
from rally.plugins.openstack import types
|
||||
from rally.task import context
|
||||
from rally.task import types
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -68,8 +68,8 @@ class EC2ServerGenerator(context.Context):
|
||||
flavor = self.config["flavor"]
|
||||
|
||||
clients = osclients.Clients(self.context["users"][0]["credential"])
|
||||
image_id = types.EC2ImageResourceType.transform(clients=clients,
|
||||
resource_config=image)
|
||||
image_id = types.EC2Image.transform(clients=clients,
|
||||
resource_config=image)
|
||||
|
||||
for user, tenant_id in rutils.iterate_per_tenants(
|
||||
self.context["users"]):
|
||||
|
@ -19,8 +19,8 @@ from rally import consts
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack.cleanup import manager as resource_manager
|
||||
from rally.plugins.openstack.scenarios.nova import utils as nova_utils
|
||||
from rally.plugins.openstack import types
|
||||
from rally.task import context
|
||||
from rally.task import types
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -78,10 +78,10 @@ class ServerGenerator(context.Context):
|
||||
servers_per_tenant = self.config["servers_per_tenant"]
|
||||
|
||||
clients = osclients.Clients(self.context["users"][0]["credential"])
|
||||
image_id = types.ImageResourceType.transform(clients=clients,
|
||||
resource_config=image)
|
||||
flavor_id = types.FlavorResourceType.transform(clients=clients,
|
||||
resource_config=flavor)
|
||||
image_id = types.GlanceImage.transform(clients=clients,
|
||||
resource_config=image)
|
||||
flavor_id = types.Flavor.transform(clients=clients,
|
||||
resource_config=flavor)
|
||||
|
||||
for iter_, (user, tenant_id) in enumerate(rutils.iterate_per_tenants(
|
||||
self.context["users"])):
|
||||
|
@ -25,8 +25,8 @@ from rally import consts
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack.scenarios.nova import utils as nova_utils
|
||||
from rally.plugins.openstack.scenarios.vm import vmtasks
|
||||
from rally.plugins.openstack import types
|
||||
from rally.task import context
|
||||
from rally.task import types
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -147,9 +147,9 @@ class BaseCustomImageGenerator(context.Context):
|
||||
|
||||
clients = osclients.Clients(user["credential"])
|
||||
|
||||
image_id = types.ImageResourceType.transform(
|
||||
image_id = types.GlanceImage.transform(
|
||||
clients=clients, resource_config=self.config["image"])
|
||||
flavor_id = types.FlavorResourceType.transform(
|
||||
flavor_id = types.Flavor.transform(
|
||||
clients=clients, resource_config=self.config["flavor"])
|
||||
|
||||
vm_scenario = vmtasks.VMTasks(self.context, clients=clients)
|
||||
|
@ -22,7 +22,7 @@ from tests.unit import test
|
||||
|
||||
CTX = "rally.plugins.openstack.context.ec2"
|
||||
SCN = "rally.plugins.openstack.scenarios"
|
||||
TYP = "rally.task.types"
|
||||
TYP = "rally.plugins.openstack.types"
|
||||
|
||||
|
||||
class EC2ServerGeneratorTestCase(test.TestCase):
|
||||
@ -60,11 +60,10 @@ class EC2ServerGeneratorTestCase(test.TestCase):
|
||||
|
||||
@mock.patch("%s.ec2.utils.EC2Scenario._boot_servers" % SCN,
|
||||
return_value=[fakes.FakeServer(id=str(i)) for i in range(5)])
|
||||
@mock.patch("%s.EC2ImageResourceType.transform" % TYP,
|
||||
return_value=mock.MagicMock())
|
||||
@mock.patch("%s.EC2Image.transform" % TYP, return_value=mock.MagicMock())
|
||||
@mock.patch("%s.servers.osclients" % CTX, return_value=fakes.FakeClients())
|
||||
def test_setup(self, mock_osclients,
|
||||
mock_ec2_image_resource_type_transform,
|
||||
mock_ec2_image_transform,
|
||||
mock_ec2_scenario__boot_servers):
|
||||
|
||||
tenants_count = 2
|
||||
|
@ -23,7 +23,7 @@ from tests.unit import test
|
||||
|
||||
CTX = "rally.plugins.openstack.context.nova"
|
||||
SCN = "rally.plugins.openstack.scenarios"
|
||||
TYP = "rally.task.types"
|
||||
TYP = "rally.plugins.openstack.types"
|
||||
|
||||
|
||||
class ServerGeneratorTestCase(test.ScenarioTestCase):
|
||||
@ -57,13 +57,12 @@ class ServerGeneratorTestCase(test.ScenarioTestCase):
|
||||
fakes.FakeServer(id="uuid"),
|
||||
fakes.FakeServer(id="uuid")
|
||||
])
|
||||
@mock.patch("%s.ImageResourceType.transform" % TYP,
|
||||
return_value=mock.MagicMock())
|
||||
@mock.patch("%s.FlavorResourceType.transform" % TYP,
|
||||
@mock.patch("%s.GlanceImage.transform" % TYP,
|
||||
return_value=mock.MagicMock())
|
||||
@mock.patch("%s.Flavor.transform" % TYP, return_value=mock.MagicMock())
|
||||
@mock.patch("%s.servers.osclients" % CTX, return_value=fakes.FakeClients())
|
||||
def test_setup(self, mock_osclients, mock_flavor_resource_type_transform,
|
||||
mock_image_resource_type_transform,
|
||||
def test_setup(self, mock_osclients, mock_flavor_transform,
|
||||
mock_glance_image_transform,
|
||||
mock_nova_scenario__boot_servers):
|
||||
|
||||
tenants_count = 2
|
||||
@ -111,8 +110,8 @@ class ServerGeneratorTestCase(test.ScenarioTestCase):
|
||||
servers_ctx = servers.ServerGenerator(self.context)
|
||||
servers_ctx.setup()
|
||||
self.assertEqual(new_context, self.context)
|
||||
image_id = mock_image_resource_type_transform.return_value
|
||||
flavor_id = mock_flavor_resource_type_transform.return_value
|
||||
image_id = mock_glance_image_transform.return_value
|
||||
flavor_id = mock_flavor_transform.return_value
|
||||
servers_ctx_config = self.context["config"]["servers"]
|
||||
expected_auto_nic = servers_ctx_config.get("auto_assign_nic", False)
|
||||
expected_requests = servers_ctx_config.get("servers_per_tenant", False)
|
||||
|
@ -64,13 +64,11 @@ class BaseCustomImageContextVMTestCase(test.TestCase):
|
||||
|
||||
@mock.patch("%s.vmtasks.VMTasks" % BASE)
|
||||
@mock.patch("%s.osclients.Clients" % BASE)
|
||||
@mock.patch("%s.types.ImageResourceType.transform" % BASE,
|
||||
return_value="image")
|
||||
@mock.patch("%s.types.FlavorResourceType.transform" % BASE,
|
||||
return_value="flavor")
|
||||
@mock.patch("%s.types.GlanceImage.transform" % BASE, return_value="image")
|
||||
@mock.patch("%s.types.Flavor.transform" % BASE, return_value="flavor")
|
||||
def test_create_one_image(
|
||||
self, mock_flavor_resource_type_transform,
|
||||
mock_image_resource_type_transform, mock_clients, mock_vm_tasks):
|
||||
self, mock_flavor_transform, mock_glance_image_transform,
|
||||
mock_clients, mock_vm_tasks):
|
||||
ip = {"ip": "foo_ip", "id": "foo_id", "is_floating": True}
|
||||
fake_server = mock.Mock()
|
||||
|
||||
@ -95,10 +93,10 @@ class BaseCustomImageContextVMTestCase(test.TestCase):
|
||||
custom_image = generator_ctx.create_one_image(user,
|
||||
foo_arg="foo_value")
|
||||
|
||||
mock_flavor_resource_type_transform.assert_called_once_with(
|
||||
mock_flavor_transform.assert_called_once_with(
|
||||
clients=mock_clients.return_value,
|
||||
resource_config={"name": "flavor"})
|
||||
mock_image_resource_type_transform.assert_called_once_with(
|
||||
mock_glance_image_transform.assert_called_once_with(
|
||||
clients=mock_clients.return_value,
|
||||
resource_config={"name": "image"})
|
||||
mock_vm_tasks.assert_called_once_with(
|
||||
@ -124,13 +122,14 @@ class BaseCustomImageContextVMTestCase(test.TestCase):
|
||||
|
||||
@mock.patch("%s.vmtasks.VMTasks" % BASE)
|
||||
@mock.patch("%s.osclients.Clients" % BASE)
|
||||
@mock.patch("%s.types.ImageResourceType.transform" % BASE,
|
||||
@mock.patch("%s.types.GlanceImage.transform" % BASE,
|
||||
return_value="image")
|
||||
@mock.patch("%s.types.FlavorResourceType.transform" % BASE,
|
||||
@mock.patch("%s.types.Flavor.transform" % BASE,
|
||||
return_value="flavor")
|
||||
def test_create_one_image_cleanup(
|
||||
self, mock_flavor_resource_type_transform,
|
||||
mock_image_resource_type_transform, mock_clients, mock_vm_tasks):
|
||||
self, mock_flavor_transform,
|
||||
mock_glance_image_transform, mock_clients,
|
||||
mock_vm_tasks):
|
||||
ip = {"ip": "foo_ip", "id": "foo_id", "is_floating": True}
|
||||
fake_server = mock.Mock()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user