[cleanup] Use workload uuid in resource names
* Added superclass where it was missing. Change-Id: I8460737386166f8eda2cd1665592c490b369f932
This commit is contained in:
parent
0ba513201a
commit
4a81efda5c
@ -85,4 +85,4 @@ class VolumeGenerator(context.Context):
|
||||
users=self.context.get("users", []),
|
||||
api_versions=self.context["config"].get("api_versions"),
|
||||
superclass=self.__class__,
|
||||
task_id=self.context["task"]["uuid"])
|
||||
task_id=self.get_owner_id())
|
||||
|
@ -52,4 +52,4 @@ class AdminCleanup(base.CleanupMixin, context.Context):
|
||||
users=self.context.get("users", []),
|
||||
api_versions=self.context["config"].get("api_versions"),
|
||||
superclass=scenario.OpenStackScenario,
|
||||
task_id=self.context["task"]["uuid"])
|
||||
task_id=self.get_owner_id())
|
||||
|
@ -51,5 +51,5 @@ class UserCleanup(base.CleanupMixin, context.Context):
|
||||
users=self.context.get("users", []),
|
||||
api_versions=self.context["config"].get("api_versions"),
|
||||
superclass=scenario.OpenStackScenario,
|
||||
task_id=self.context["task"]["uuid"]
|
||||
task_id=self.get_owner_id()
|
||||
)
|
||||
|
@ -134,7 +134,8 @@ class HeatDataplane(context.Context):
|
||||
if "key_name" not in parameters:
|
||||
parameters["key_name"] = user["keypair"]["name"]
|
||||
heat_scenario = heat_utils.HeatScenario(
|
||||
{"user": user, "task": self.context["task"]})
|
||||
{"user": user, "task": self.context["task"],
|
||||
"owner_id": self.context["owner_id"]})
|
||||
self.context["tenants"][tenant_id]["stack_dataplane"] = []
|
||||
for i in range(self.config["stacks_per_tenant"]):
|
||||
stack = heat_scenario._create_stack(template, files=files,
|
||||
@ -146,4 +147,6 @@ class HeatDataplane(context.Context):
|
||||
@logging.log_task_wrapper(LOG.info, _("Exit context: `HeatDataplane`"))
|
||||
def cleanup(self):
|
||||
resource_manager.cleanup(names=["heat.stacks"],
|
||||
users=self.context.get("users", []))
|
||||
users=self.context.get("users", []),
|
||||
superclass=heat_utils.HeatScenario,
|
||||
task_id=self.get_owner_id())
|
||||
|
@ -51,7 +51,8 @@ class ZoneGenerator(context.Context):
|
||||
self.context["tenants"][tenant_id].setdefault("zones", [])
|
||||
designate_util = utils.DesignateScenario(
|
||||
{"user": user,
|
||||
"task": self.context["task"]})
|
||||
"task": self.context["task"],
|
||||
"owner_id": self.context["owner_id"]})
|
||||
for i in range(self.config["zones_per_tenant"]):
|
||||
zone = designate_util._create_zone()
|
||||
self.context["tenants"][tenant_id]["zones"].append(zone)
|
||||
@ -61,4 +62,4 @@ class ZoneGenerator(context.Context):
|
||||
resource_manager.cleanup(names=["designate.zones"],
|
||||
users=self.context.get("users", []),
|
||||
superclass=utils.DesignateScenario,
|
||||
task_id=self.context["task"]["uuid"])
|
||||
task_id=self.get_owner_id())
|
||||
|
@ -75,8 +75,10 @@ class EC2ServerGenerator(context.Context):
|
||||
self.context["users"]):
|
||||
LOG.debug("Booting servers for tenant %s "
|
||||
% (user["tenant_id"]))
|
||||
user_clients = osclients.Clients(user["credential"])
|
||||
ec2_scenario = ec2_utils.EC2Scenario(clients=user_clients)
|
||||
ec2_scenario = ec2_utils.EC2Scenario({
|
||||
"user": user,
|
||||
"task": self.context["task"],
|
||||
"owner_id": self.context["owner_id"]})
|
||||
|
||||
LOG.debug(
|
||||
"Calling _boot_servers with "
|
||||
@ -97,4 +99,4 @@ class EC2ServerGenerator(context.Context):
|
||||
resource_manager.cleanup(names=["ec2.servers"],
|
||||
users=self.context.get("users", []),
|
||||
superclass=ec2_utils.EC2Scenario,
|
||||
task_id=self.context["task"]["uuid"])
|
||||
task_id=self.get_owner_id())
|
||||
|
@ -175,4 +175,4 @@ class ImageGenerator(context.Context):
|
||||
api_versions=self.context["config"].get(
|
||||
"api_versions"),
|
||||
superclass=self.__class__,
|
||||
task_id=self.context["task"]["uuid"])
|
||||
task_id=self.get_owner_id())
|
||||
|
@ -77,7 +77,8 @@ class StackGenerator(context.Context):
|
||||
for user, tenant_id in rutils.iterate_per_tenants(
|
||||
self.context["users"]):
|
||||
heat_scenario = heat_utils.HeatScenario(
|
||||
{"user": user, "task": self.context["task"]})
|
||||
{"user": user, "task": self.context["task"],
|
||||
"owner_id": self.context["owner_id"]})
|
||||
self.context["tenants"][tenant_id]["stacks"] = []
|
||||
for i in range(self.config["stacks_per_tenant"]):
|
||||
stack = heat_scenario._create_stack(template)
|
||||
@ -88,4 +89,4 @@ class StackGenerator(context.Context):
|
||||
resource_manager.cleanup(names=["heat.stacks"],
|
||||
users=self.context.get("users", []),
|
||||
superclass=heat_utils.HeatScenario,
|
||||
task_id=self.context["task"]["uuid"])
|
||||
task_id=self.get_owner_id())
|
||||
|
@ -109,6 +109,7 @@ class ClusterTemplateGenerator(context.Context):
|
||||
nova_scenario = nova_utils.NovaScenario({
|
||||
"user": user,
|
||||
"task": self.context["task"],
|
||||
"owner_id": self.context["owner_id"],
|
||||
"config": {"api_versions": self.context["config"].get(
|
||||
"api_versions", [])}
|
||||
})
|
||||
@ -117,6 +118,7 @@ class ClusterTemplateGenerator(context.Context):
|
||||
magnum_scenario = magnum_utils.MagnumScenario({
|
||||
"user": user,
|
||||
"task": self.context["task"],
|
||||
"owner_id": self.context["owner_id"],
|
||||
"config": {"api_versions": self.context["config"].get(
|
||||
"api_versions", [])}
|
||||
})
|
||||
@ -130,5 +132,12 @@ class ClusterTemplateGenerator(context.Context):
|
||||
@logging.log_task_wrapper(LOG.info, _("Exit context: `ClusterTemplate`"))
|
||||
def cleanup(self):
|
||||
resource_manager.cleanup(
|
||||
names=["magnum.cluster_templates", "nova.keypairs"],
|
||||
users=self.context.get("users", []))
|
||||
names=["nova.keypairs"],
|
||||
users=self.context.get("users", []),
|
||||
superclass=nova_utils.NovaScenario,
|
||||
task_id=self.get_owner_id())
|
||||
resource_manager.cleanup(
|
||||
names=["magnum.cluster_templates"],
|
||||
users=self.context.get("users", []),
|
||||
superclass=magnum_utils.MagnumScenario,
|
||||
task_id=self.get_owner_id())
|
||||
|
@ -53,6 +53,7 @@ class ClusterGenerator(context.Context):
|
||||
magnum_scenario = magnum_utils.MagnumScenario({
|
||||
"user": user,
|
||||
"task": self.context["task"],
|
||||
"owner_id": self.context["owner_id"],
|
||||
"config": {"api_versions": self.context["config"].get(
|
||||
"api_versions", [])}
|
||||
})
|
||||
@ -71,4 +72,6 @@ class ClusterGenerator(context.Context):
|
||||
def cleanup(self):
|
||||
resource_manager.cleanup(
|
||||
names=["magnum.clusters"],
|
||||
users=self.context.get("users", []))
|
||||
users=self.context.get("users", []),
|
||||
superclass=magnum_utils.MagnumScenario,
|
||||
task_id=self.get_owner_id())
|
||||
|
@ -76,6 +76,7 @@ class SecurityServices(context.Context):
|
||||
if self.config["security_services"]:
|
||||
manila_scenario = manila_utils.ManilaScenario({
|
||||
"task": self.task,
|
||||
"owner_id": self.context["owner_id"],
|
||||
"user": user,
|
||||
"config": {
|
||||
"api_versions": self.context["config"].get(
|
||||
@ -92,4 +93,5 @@ class SecurityServices(context.Context):
|
||||
resource_manager.cleanup(
|
||||
names=["manila.security_services"],
|
||||
users=self.context.get("users", []),
|
||||
)
|
||||
superclass=manila_utils.ManilaScenario,
|
||||
task_id=self.get_owner_id())
|
||||
|
@ -86,6 +86,7 @@ class Shares(context.Context):
|
||||
utils.iterate_per_tenants(self.context.get("users", []))):
|
||||
manila_scenario = manila_utils.ManilaScenario({
|
||||
"task": self.task,
|
||||
"owner_id": self.context["owner_id"],
|
||||
"user": user,
|
||||
"config": {
|
||||
"api_versions": self.context["config"].get(
|
||||
@ -104,4 +105,5 @@ class Shares(context.Context):
|
||||
resource_manager.cleanup(
|
||||
names=["manila.shares"],
|
||||
users=self.context.get("users", []),
|
||||
)
|
||||
superclass=manila_utils.ManilaScenario,
|
||||
task_id=self.get_owner_id())
|
||||
|
@ -52,6 +52,7 @@ class EnvironmentGenerator(context.Context):
|
||||
murano_util = murano_utils.MuranoScenario(
|
||||
{"user": user,
|
||||
"task": self.context["task"],
|
||||
"owner_id": self.context["owner_id"],
|
||||
"config": self.context["config"]})
|
||||
env = murano_util._create_environment()
|
||||
self.context["tenants"][tenant_id]["environments"].append(env)
|
||||
@ -60,4 +61,6 @@ class EnvironmentGenerator(context.Context):
|
||||
_("Exit context: `Murano environments`"))
|
||||
def cleanup(self):
|
||||
resource_manager.cleanup(names=["murano.environments"],
|
||||
users=self.context.get("users", []))
|
||||
users=self.context.get("users", []),
|
||||
superclass=murano_utils.MuranoScenario,
|
||||
task_id=self.get_owner_id())
|
||||
|
@ -25,7 +25,6 @@ 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.scenarios.murano import utils as murano_utils
|
||||
from rally.task import context
|
||||
|
||||
|
||||
@ -69,6 +68,7 @@ class PackageGenerator(context.Context):
|
||||
self.context["tenants"][tenant_id]["packages"] = []
|
||||
if is_config_app_dir:
|
||||
self.context["tenants"][tenant_id]["murano_ctx"] = zip_name
|
||||
# TODO(astudenov): use self.generate_random_name()
|
||||
package = clients.murano().packages.create(
|
||||
{"categories": ["Web"], "tags": ["tag"]},
|
||||
{"file": open(zip_name)})
|
||||
@ -79,5 +79,5 @@ class PackageGenerator(context.Context):
|
||||
def cleanup(self):
|
||||
resource_manager.cleanup(names=["murano.packages"],
|
||||
users=self.context.get("users", []),
|
||||
superclass=murano_utils.MuranoScenario,
|
||||
task_id=self.context["task"]["uuid"])
|
||||
superclass=self.__class__,
|
||||
task_id=self.get_owner_id())
|
||||
|
@ -59,4 +59,4 @@ class Keypair(context.Context):
|
||||
resource_manager.cleanup(names=["nova.keypairs"],
|
||||
users=self.context.get("users", []),
|
||||
superclass=self.__class__,
|
||||
task_id=self.context["task"]["uuid"])
|
||||
task_id=self.get_owner_id())
|
||||
|
@ -107,6 +107,7 @@ class ServerGenerator(context.Context):
|
||||
tmp_context = {"user": user,
|
||||
"tenant": self.context["tenants"][tenant_id],
|
||||
"task": self.context["task"],
|
||||
"owner_id": self.context["owner_id"],
|
||||
"iteration": iter_}
|
||||
nova_scenario = nova_utils.NovaScenario(tmp_context)
|
||||
|
||||
@ -135,4 +136,4 @@ class ServerGenerator(context.Context):
|
||||
resource_manager.cleanup(names=["nova.servers"],
|
||||
users=self.context.get("users", []),
|
||||
superclass=nova_utils.NovaScenario,
|
||||
task_id=self.context["task"]["uuid"])
|
||||
task_id=self.get_owner_id())
|
||||
|
@ -115,7 +115,8 @@ class SaharaCluster(context.Context):
|
||||
temporary_context = {
|
||||
"user": user,
|
||||
"tenant": self.context["tenants"][tenant_id],
|
||||
"task": self.context["task"]
|
||||
"task": self.context["task"],
|
||||
"owner_id": self.context["owner_id"]
|
||||
}
|
||||
scenario = utils.SaharaScenario(context=temporary_context)
|
||||
|
||||
@ -179,4 +180,4 @@ class SaharaCluster(context.Context):
|
||||
resource_manager.cleanup(names=["sahara.clusters"],
|
||||
users=self.context.get("users", []),
|
||||
superclass=utils.SaharaScenario,
|
||||
task_id=self.context["task"]["uuid"])
|
||||
task_id=self.get_owner_id())
|
||||
|
@ -130,4 +130,4 @@ class SaharaImage(context.Context):
|
||||
resource_manager.cleanup(names=["glance.images"],
|
||||
users=self.context.get("users", []),
|
||||
superclass=self.__class__,
|
||||
task_id=self.context["task"]["uuid"])
|
||||
task_id=self.get_owner_id())
|
||||
|
@ -22,7 +22,6 @@ 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.cleanup import resources as res_cleanup
|
||||
from rally.plugins.openstack.scenarios.sahara import utils
|
||||
from rally.plugins.openstack.scenarios.swift import utils as swift_utils
|
||||
from rally.task import context
|
||||
@ -100,6 +99,7 @@ class SaharaInputDataSources(context.Context):
|
||||
swift_files, username, password):
|
||||
swift_scenario = swift_utils.SwiftScenario(clients=clients,
|
||||
context=self.context)
|
||||
# TODO(astudenov): use self.generate_random_name()
|
||||
container_name = "rally_" + parse.urlparse(input_url).netloc.rstrip(
|
||||
".sahara")
|
||||
self.context["sahara"]["container_name"] = (
|
||||
@ -121,14 +121,13 @@ class SaharaInputDataSources(context.Context):
|
||||
@logging.log_task_wrapper(LOG.info, _("Exit context: `Sahara Input Data"
|
||||
"Sources`"))
|
||||
def cleanup(self):
|
||||
resources = ["data_sources"]
|
||||
for swift_object in self.context["sahara"]["swift_objects"]:
|
||||
res_cleanup.SwiftObject(resource=swift_object[1])
|
||||
res_cleanup.SwiftContainer(
|
||||
resource=self.context["sahara"]["container_name"])
|
||||
|
||||
resource_manager.cleanup(
|
||||
names=["sahara.%s" % res for res in resources],
|
||||
names=["swift.object", "swift.container"],
|
||||
users=self.context.get("users", []),
|
||||
superclass=utils.SaharaScenario,
|
||||
task_id=self.context["task"]["uuid"])
|
||||
superclass=swift_utils.SwiftScenario,
|
||||
task_id=self.get_owner_id())
|
||||
resource_manager.cleanup(
|
||||
names=["sahara.data_sources"],
|
||||
users=self.context.get("users", []),
|
||||
superclass=self.__class__,
|
||||
task_id=self.get_owner_id())
|
||||
|
@ -99,9 +99,13 @@ class SaharaOutputDataSources(context.Context):
|
||||
@logging.log_task_wrapper(LOG.info,
|
||||
_("Exit context: `Sahara Output Data Sources`"))
|
||||
def cleanup(self):
|
||||
resources = ["data_sources"]
|
||||
resource_manager.cleanup(
|
||||
names=["sahara.%s" % res for res in resources],
|
||||
names=["swift.object", "swift.container"],
|
||||
users=self.context.get("users", []),
|
||||
superclass=utils.SaharaScenario,
|
||||
task_id=self.context["task"]["uuid"])
|
||||
superclass=self.__class__,
|
||||
task_id=self.get_owner_id())
|
||||
resource_manager.cleanup(
|
||||
names=["sahara.data_sources"],
|
||||
users=self.context.get("users", []),
|
||||
superclass=self.__class__,
|
||||
task_id=self.get_owner_id())
|
||||
|
@ -79,6 +79,7 @@ class AuditTemplateGenerator(context.Context):
|
||||
def setup(self):
|
||||
watcher_scenario = watcher_utils.WatcherScenario(
|
||||
{"admin": self.context["admin"], "task": self.context["task"],
|
||||
"owner_id": self.context["owner_id"],
|
||||
"config": {
|
||||
"api_versions": self.context["config"].get(
|
||||
"api_versions", [])}
|
||||
@ -109,4 +110,6 @@ class AuditTemplateGenerator(context.Context):
|
||||
def cleanup(self):
|
||||
resource_manager.cleanup(names=["watcher.action_plan",
|
||||
"watcher.audit_template"],
|
||||
admin=self.context.get("admin", []))
|
||||
admin=self.context.get("admin", []),
|
||||
superclass=watcher_utils.WatcherScenario,
|
||||
task_id=self.get_owner_id())
|
||||
|
@ -144,7 +144,7 @@ class VolumeGeneratorTestCase(test.ScenarioTestCase):
|
||||
mock_cleanup.assert_called_once_with(
|
||||
names=["cinder.volumes"], users=self.context["users"],
|
||||
api_versions=None, superclass=volumes_ctx.__class__,
|
||||
task_id=self.context["task"]["uuid"])
|
||||
task_id=self.context["owner_id"])
|
||||
|
||||
@mock.patch("%s.cinder.volumes.resource_manager.cleanup" % CTX)
|
||||
def test_cleanup_api_versions(self, mock_cleanup):
|
||||
@ -198,4 +198,4 @@ class VolumeGeneratorTestCase(test.ScenarioTestCase):
|
||||
users=self.context["users"],
|
||||
api_versions=api_version,
|
||||
superclass=volumes_ctx.__class__,
|
||||
task_id=self.context["task"]["uuid"])
|
||||
task_id=self.context["owner_id"])
|
||||
|
@ -129,4 +129,4 @@ class ZoneGeneratorTestCase(test.ScenarioTestCase):
|
||||
names=["designate.zones"],
|
||||
users=self.context["users"],
|
||||
superclass=utils.DesignateScenario,
|
||||
task_id=self.context["task"]["uuid"])
|
||||
task_id=self.context["owner_id"])
|
||||
|
@ -55,6 +55,7 @@ class EC2ServerGeneratorTestCase(test.TestCase):
|
||||
},
|
||||
"admin": {"credential": mock.MagicMock()},
|
||||
"task": mock.MagicMock(),
|
||||
"owner_id": "foo_uuid",
|
||||
"users": users,
|
||||
"tenants": tenants
|
||||
}
|
||||
@ -110,4 +111,4 @@ class EC2ServerGeneratorTestCase(test.TestCase):
|
||||
names=["ec2.servers"],
|
||||
users=context["users"],
|
||||
superclass=ec2_utils.EC2Scenario,
|
||||
task_id=context["task"]["uuid"])
|
||||
task_id="foo_uuid")
|
||||
|
@ -208,4 +208,4 @@ class ImageGeneratorTestCase(test.ScenarioTestCase):
|
||||
users=self.context["users"],
|
||||
api_versions=self.context["config"].get("api_versions"),
|
||||
superclass=images_ctx.__class__,
|
||||
task_id=self.context["task"]["uuid"])
|
||||
task_id=self.context["owner_id"])
|
||||
|
@ -95,4 +95,4 @@ class TestStackGenerator(test.ScenarioTestCase):
|
||||
names=["heat.stacks"],
|
||||
users=self.context["users"],
|
||||
superclass=heat_utils.HeatScenario,
|
||||
task_id=self.context["task"]["uuid"])
|
||||
task_id=self.context["owner_id"])
|
||||
|
@ -13,6 +13,8 @@
|
||||
import mock
|
||||
|
||||
from rally.plugins.openstack.context.magnum import cluster_templates
|
||||
from rally.plugins.openstack.scenarios.magnum import utils as magnum_utils
|
||||
from rally.plugins.openstack.scenarios.nova import utils as nova_utils
|
||||
from tests.unit import fakes
|
||||
from tests.unit import test
|
||||
|
||||
@ -103,6 +105,14 @@ class ClusterTemplatesGeneratorTestCase(test.ScenarioTestCase):
|
||||
})
|
||||
ct_ctx = cluster_templates.ClusterTemplateGenerator(self.context)
|
||||
ct_ctx.cleanup()
|
||||
mock_cleanup.assert_called_once_with(names=["magnum.cluster_templates",
|
||||
"nova.keypairs"],
|
||||
users=self.context["users"])
|
||||
mock_cleanup.assert_has_calls((
|
||||
mock.call(
|
||||
names=["nova.keypairs"],
|
||||
users=self.context["users"],
|
||||
superclass=nova_utils.NovaScenario,
|
||||
task_id=self.context["owner_id"]),
|
||||
mock.call(
|
||||
names=["magnum.cluster_templates"],
|
||||
users=self.context["users"],
|
||||
superclass=magnum_utils.MagnumScenario,
|
||||
task_id=self.context["owner_id"])))
|
||||
|
@ -18,6 +18,7 @@ import copy
|
||||
import mock
|
||||
|
||||
from rally.plugins.openstack.context.magnum import clusters
|
||||
from rally.plugins.openstack.scenarios.magnum import utils as magnum_utils
|
||||
from tests.unit import test
|
||||
|
||||
CTX = "rally.plugins.openstack.context.magnum"
|
||||
@ -147,4 +148,6 @@ class ClustersGeneratorTestCase(test.ScenarioTestCase):
|
||||
clusters_ctx.cleanup()
|
||||
mock_cleanup.assert_called_once_with(
|
||||
names=["magnum.clusters"],
|
||||
users=self.context["users"])
|
||||
users=self.context["users"],
|
||||
superclass=magnum_utils.MagnumScenario,
|
||||
task_id=self.context["owner_id"])
|
||||
|
@ -19,6 +19,7 @@ import six
|
||||
|
||||
from rally.plugins.openstack.context.manila import consts
|
||||
from rally.plugins.openstack.context.manila import manila_security_services
|
||||
from rally.plugins.openstack.scenarios.manila import utils as manila_utils
|
||||
from tests.unit import test
|
||||
|
||||
CONTEXT_NAME = consts.SECURITY_SERVICES_CONTEXT_NAME
|
||||
@ -71,6 +72,7 @@ class SecurityServicesTestCase(test.ScenarioTestCase):
|
||||
"endpoint": mock.MagicMock(),
|
||||
},
|
||||
"task": mock.MagicMock(),
|
||||
"owner_id": "foo_uuid",
|
||||
"users": users,
|
||||
"tenants": tenants,
|
||||
}
|
||||
@ -108,6 +110,7 @@ class SecurityServicesTestCase(test.ScenarioTestCase):
|
||||
mock_manila_scenario.call_args_list,
|
||||
[mock.call({
|
||||
"task": inst.task,
|
||||
"owner_id": "foo_uuid",
|
||||
"config": {"api_versions": []},
|
||||
"user": user})
|
||||
for user in inst.context["users"] if user["id"] == 0]
|
||||
@ -162,4 +165,7 @@ class SecurityServicesTestCase(test.ScenarioTestCase):
|
||||
inst.cleanup()
|
||||
|
||||
mock_resource_manager.cleanup.assert_called_once_with(
|
||||
names=["manila.security_services"], users=ctxt["users"])
|
||||
names=["manila.security_services"],
|
||||
users=ctxt["users"],
|
||||
superclass=manila_utils.ManilaScenario,
|
||||
task_id="foo_uuid")
|
||||
|
@ -22,6 +22,7 @@ import six
|
||||
from rally import consts as rally_consts
|
||||
from rally.plugins.openstack.context.manila import consts
|
||||
from rally.plugins.openstack.context.manila import manila_shares
|
||||
from rally.plugins.openstack.scenarios.manila import utils as manila_utils
|
||||
from tests.unit import test
|
||||
|
||||
MANILA_UTILS_PATH = (
|
||||
@ -80,6 +81,7 @@ class SharesTestCase(test.TestCase):
|
||||
"credential": mock.MagicMock(),
|
||||
},
|
||||
"task": mock.MagicMock(),
|
||||
"owner_id": "foo_uuid",
|
||||
"users": users,
|
||||
"tenants": tenants,
|
||||
}
|
||||
@ -199,4 +201,5 @@ class SharesTestCase(test.TestCase):
|
||||
mock_cleanup_manager_cleanup.assert_called_once_with(
|
||||
names=["manila.shares"],
|
||||
users=inst.context.get("users", []),
|
||||
)
|
||||
superclass=manila_utils.ManilaScenario,
|
||||
task_id="foo_uuid")
|
||||
|
@ -16,6 +16,7 @@
|
||||
import mock
|
||||
|
||||
from rally.plugins.openstack.context.murano import murano_environments
|
||||
from rally.plugins.openstack.scenarios.murano import utils as murano_utils
|
||||
from tests.unit import test
|
||||
|
||||
CTX = "rally.plugins.openstack.context.murano.murano_environments"
|
||||
@ -44,6 +45,7 @@ class MuranoEnvironmentGeneratorTestCase(test.TestCase):
|
||||
"credential": mock.MagicMock()
|
||||
},
|
||||
"task": mock.MagicMock(),
|
||||
"owner_id": "foo_uuid",
|
||||
"users": [
|
||||
{
|
||||
"id": "user_0",
|
||||
@ -82,5 +84,8 @@ class MuranoEnvironmentGeneratorTestCase(test.TestCase):
|
||||
murano_ctx.setup()
|
||||
murano_ctx.cleanup()
|
||||
|
||||
mock_cleanup.assert_called_once_with(names=["murano.environments"],
|
||||
users=murano_ctx.context["users"])
|
||||
mock_cleanup.assert_called_once_with(
|
||||
names=["murano.environments"],
|
||||
users=murano_ctx.context["users"],
|
||||
superclass=murano_utils.MuranoScenario,
|
||||
task_id="foo_uuid")
|
||||
|
@ -16,7 +16,6 @@
|
||||
import mock
|
||||
|
||||
from rally.plugins.openstack.context.murano import murano_packages
|
||||
from rally.plugins.openstack.scenarios.murano import utils as murano_utils
|
||||
from tests.unit import test
|
||||
|
||||
CTX = "rally.plugins.openstack.context.murano.murano_packages"
|
||||
@ -47,6 +46,7 @@ class MuranoPackageGeneratorTestCase(test.TestCase):
|
||||
"credential": mock.MagicMock()
|
||||
},
|
||||
"task": mock.MagicMock(),
|
||||
"owner_id": "foo_uuid",
|
||||
"users": [
|
||||
{
|
||||
"id": "user_0",
|
||||
@ -93,8 +93,8 @@ class MuranoPackageGeneratorTestCase(test.TestCase):
|
||||
mock_cleanup.assert_called_once_with(
|
||||
names=["murano.packages"],
|
||||
users=murano_ctx.context["users"],
|
||||
superclass=murano_utils.MuranoScenario,
|
||||
task_id=murano_ctx.context["task"]["uuid"])
|
||||
superclass=murano_packages.PackageGenerator,
|
||||
task_id="foo_uuid")
|
||||
|
||||
@mock.patch("%s.osclients" % CTX)
|
||||
@mock.patch("%s.resource_manager.cleanup" % CTX)
|
||||
@ -114,5 +114,5 @@ class MuranoPackageGeneratorTestCase(test.TestCase):
|
||||
mock_cleanup.assert_called_once_with(
|
||||
names=["murano.packages"],
|
||||
users=murano_ctx.context["users"],
|
||||
superclass=murano_utils.MuranoScenario,
|
||||
task_id=ctx_dict["task"]["uuid"])
|
||||
superclass=murano_packages.PackageGenerator,
|
||||
task_id="foo_uuid")
|
||||
|
@ -174,4 +174,4 @@ class ServerGeneratorTestCase(test.ScenarioTestCase):
|
||||
names=["nova.servers"],
|
||||
users=self.context["users"],
|
||||
superclass=nova_utils.NovaScenario,
|
||||
task_id=self.context["task"]["uuid"])
|
||||
task_id=self.context["owner_id"])
|
||||
|
@ -111,7 +111,7 @@ class SaharaClusterTestCase(test.ScenarioTestCase):
|
||||
names=["sahara.clusters"],
|
||||
users=self.context["users"],
|
||||
superclass=sahara_utils.SaharaScenario,
|
||||
task_id=self.context["task"]["uuid"])
|
||||
task_id=self.context["owner_id"])
|
||||
|
||||
@mock.patch("%s.sahara_cluster.utils.SaharaScenario._launch_cluster" % CTX,
|
||||
return_value=mock.MagicMock(id=42))
|
||||
|
@ -133,7 +133,7 @@ class SaharaImageTestCase(test.ScenarioTestCase):
|
||||
names=["glance.images"],
|
||||
users=ctx["users"],
|
||||
superclass=sahara_ctx.__class__,
|
||||
task_id=ctx["task"]["uuid"])
|
||||
task_id=ctx["owner_id"])
|
||||
|
||||
@mock.patch("%s.glance.utils.GlanceScenario._create_image" % SCN,
|
||||
return_value=mock.MagicMock(id=42))
|
||||
|
@ -15,7 +15,7 @@
|
||||
import mock
|
||||
|
||||
from rally.plugins.openstack.context.sahara import sahara_input_data_sources
|
||||
from rally.plugins.openstack.scenarios.sahara import utils as sahara_utils
|
||||
from rally.plugins.openstack.scenarios.swift import utils as swift_utils
|
||||
from tests.unit import test
|
||||
|
||||
CTX = "rally.plugins.openstack.context.sahara"
|
||||
@ -88,11 +88,16 @@ class SaharaInputDataSourcesTestCase(test.ScenarioTestCase):
|
||||
|
||||
sahara_ctx.cleanup()
|
||||
|
||||
mock_cleanup.assert_called_once_with(
|
||||
names=["sahara.data_sources"],
|
||||
users=self.context["users"],
|
||||
superclass=sahara_utils.SaharaScenario,
|
||||
task_id=self.context["task"]["uuid"])
|
||||
mock_cleanup.assert_has_calls((
|
||||
mock.call(names=["swift.object", "swift.container"],
|
||||
users=self.context["users"],
|
||||
superclass=swift_utils.SwiftScenario,
|
||||
task_id=self.context["owner_id"]),
|
||||
mock.call(
|
||||
names=["sahara.data_sources"],
|
||||
users=self.context["users"],
|
||||
superclass=sahara_input_data_sources.SaharaInputDataSources,
|
||||
task_id=self.context["owner_id"])))
|
||||
|
||||
@mock.patch("requests.get")
|
||||
@mock.patch("%s.sahara_input_data_sources.osclients" % CTX)
|
||||
@ -156,8 +161,13 @@ class SaharaInputDataSourcesTestCase(test.ScenarioTestCase):
|
||||
|
||||
sahara_ctx.cleanup()
|
||||
|
||||
mock_resource_manager.cleanup.assert_called_once_with(
|
||||
names=["sahara.data_sources"],
|
||||
users=self.context["users"],
|
||||
superclass=sahara_utils.SaharaScenario,
|
||||
task_id=self.context["task"]["uuid"])
|
||||
mock_resource_manager.cleanup.assert_has_calls((
|
||||
mock.call(names=["swift.object", "swift.container"],
|
||||
users=self.context["users"],
|
||||
superclass=mock_swift_utils.SwiftScenario,
|
||||
task_id=self.context["owner_id"]),
|
||||
mock.call(
|
||||
names=["sahara.data_sources"],
|
||||
users=self.context["users"],
|
||||
superclass=sahara_input_data_sources.SaharaInputDataSources,
|
||||
task_id=self.context["owner_id"])))
|
||||
|
@ -16,7 +16,6 @@ import mock
|
||||
|
||||
from rally.plugins.openstack.context.sahara import sahara_output_data_sources
|
||||
from rally.plugins.openstack import credential as oscredential
|
||||
from rally.plugins.openstack.scenarios.sahara import utils as sahara_utils
|
||||
from tests.unit import test
|
||||
|
||||
CTX = "rally.plugins.openstack.context.sahara"
|
||||
@ -98,11 +97,17 @@ class SaharaOutputDataSourcesTestCase(test.ScenarioTestCase):
|
||||
|
||||
sahara_ctx.cleanup()
|
||||
|
||||
mock_cleanup.assert_called_once_with(
|
||||
names=["sahara.data_sources"],
|
||||
users=self.context["users"],
|
||||
superclass=sahara_utils.SaharaScenario,
|
||||
task_id=self.context["task"]["uuid"])
|
||||
mock_cleanup.assert_has_calls((
|
||||
mock.call(
|
||||
names=["swift.object", "swift.container"],
|
||||
users=self.context["users"],
|
||||
superclass=sahara_output_data_sources.SaharaOutputDataSources,
|
||||
task_id=self.context["owner_id"]),
|
||||
mock.call(
|
||||
names=["sahara.data_sources"],
|
||||
users=self.context["users"],
|
||||
superclass=sahara_output_data_sources.SaharaOutputDataSources,
|
||||
task_id=self.context["owner_id"])))
|
||||
|
||||
@mock.patch("%s.sahara_output_data_sources.osclients" % CTX)
|
||||
def test_setup_inputs_swift(self, mock_osclients):
|
||||
|
@ -15,6 +15,7 @@
|
||||
import mock
|
||||
|
||||
from rally.plugins.openstack.context.watcher import audit_templates
|
||||
from rally.plugins.openstack.scenarios.watcher import utils as watcher_utils
|
||||
from tests.unit import fakes
|
||||
from tests.unit import test
|
||||
|
||||
@ -91,4 +92,6 @@ class AuditTemplateTestCase(test.ScenarioTestCase):
|
||||
audit_templates_ctx.cleanup()
|
||||
mock_cleanup.assert_called_once_with(
|
||||
names=["watcher.action_plan", "watcher.audit_template"],
|
||||
admin=self.context["admin"])
|
||||
admin=self.context["admin"],
|
||||
superclass=watcher_utils.WatcherScenario,
|
||||
task_id=self.context["owner_id"])
|
||||
|
@ -208,4 +208,5 @@ class FakeClientsScenarioTestCase(ScenarioTestCase):
|
||||
|
||||
def get_test_context(**kwargs):
|
||||
kwargs["task"] = {"uuid": str(uuid.uuid4())}
|
||||
kwargs["owner_id"] = str(uuid.uuid4())
|
||||
return kwargs
|
||||
|
Loading…
x
Reference in New Issue
Block a user