Merge "Remove deprecated code"
This commit is contained in:
commit
e3ff3eb1a3
@ -36,9 +36,6 @@ _rally()
|
||||
OPTS["task_status"]="--uuid"
|
||||
OPTS["task_use"]="--task"
|
||||
OPTS["task_validate"]="--deployment --task --task-args --task-args-file"
|
||||
OPTS["use_deployment"]="--deployment"
|
||||
OPTS["use_task"]="--uuid"
|
||||
OPTS["use_verification"]="--uuid"
|
||||
OPTS["verify_compare"]="--uuid-1 --uuid-2 --csv --html --json --output-file --threshold"
|
||||
OPTS["verify_detailed"]="--uuid --sort-by"
|
||||
OPTS["verify_list"]=""
|
||||
|
137
rally/api.py
137
rally/api.py
@ -24,7 +24,6 @@ import jsonschema
|
||||
from rally.benchmark import engine
|
||||
from rally.common.i18n import _
|
||||
from rally.common import log as logging
|
||||
from rally.common import utils
|
||||
from rally import consts
|
||||
from rally import deploy
|
||||
from rally import exceptions
|
||||
@ -302,139 +301,3 @@ class Verification(object):
|
||||
verifier.install()
|
||||
if not tempest_config:
|
||||
shutil.move(tmp_conf_path, verifier.config_file)
|
||||
|
||||
|
||||
# NOTE(msdubov): API methods below are deprecated and left for compability.
|
||||
# they're going to be removed in Rally v0.1.0.
|
||||
|
||||
|
||||
@utils.log_deprecated("Use api.Deployment.create() instead of "
|
||||
"api.create_deploy()", rally_version="0.0.2")
|
||||
def create_deploy(config, name):
|
||||
"""Create a deployment.
|
||||
|
||||
:param config: a dict with deployment configuration
|
||||
:param name: a str represents a name of the deployment
|
||||
:returns: Deployment object
|
||||
"""
|
||||
return Deployment.create(config, name)
|
||||
|
||||
|
||||
@utils.log_deprecated("Use api.Deployment.destroy() instead of "
|
||||
"api.destroy_deploy()", rally_version="0.0.2")
|
||||
def destroy_deploy(deployment):
|
||||
"""Destroy the deployment.
|
||||
|
||||
:param deployment: UUID or name of the deployment
|
||||
"""
|
||||
Deployment.destroy(deployment)
|
||||
|
||||
|
||||
@utils.log_deprecated("Use api.Deployment.recreate() instead of "
|
||||
"api.recreate_deploy()", rally_version="0.0.2")
|
||||
def recreate_deploy(deployment):
|
||||
"""Performs a clean up and then start to deploy.
|
||||
|
||||
:param deployment: UUID or name of the deployment
|
||||
"""
|
||||
Deployment.recreate(deployment)
|
||||
|
||||
|
||||
@utils.log_deprecated("Use api.Task.render_template() instead of "
|
||||
"api.task_template_render()", rally_version="0.0.2")
|
||||
def task_template_render(task_template, **kwargs):
|
||||
"""Render jinja2 task template to Rally input task.
|
||||
|
||||
:param task_template: String that contains template
|
||||
:param kwargs: Dict with template arguments
|
||||
:returns: rendered template str
|
||||
"""
|
||||
return Task.render_template(task_template, **kwargs)
|
||||
|
||||
|
||||
@utils.log_deprecated("Use api.Task.create() instead of "
|
||||
"api.create_task()", rally_version="0.0.2")
|
||||
def create_task(deployment, tag):
|
||||
"""Create a task without starting it.
|
||||
|
||||
Task is a list of benchmarks that will be called one by one, results of
|
||||
execution will be stored in DB.
|
||||
|
||||
:param deployment: UUID or name of the deployment
|
||||
:param tag: tag for this task
|
||||
:returns: Task object
|
||||
"""
|
||||
return Task.create(deployment, tag)
|
||||
|
||||
|
||||
@utils.log_deprecated("Use api.Task.validate() instead of "
|
||||
"api.task_validate()", rally_version="0.0.2")
|
||||
def task_validate(deployment, config):
|
||||
"""Validate a task config against specified deployment.
|
||||
|
||||
:param deployment: UUID or name of the deployment
|
||||
:param config: a dict with a task configuration
|
||||
"""
|
||||
Task.validate(deployment, config)
|
||||
|
||||
|
||||
@utils.log_deprecated("Use api.Task.start() instead of "
|
||||
"api.start_task()", rally_version="0.0.2")
|
||||
def start_task(deployment, config, task=None):
|
||||
"""Start a task.
|
||||
|
||||
Task is a list of benchmarks that will be called one by one, results of
|
||||
execution will be stored in DB.
|
||||
|
||||
:param deployment: UUID or name of the deployment
|
||||
:param config: a dict with a task configuration
|
||||
:param task: Task object. If None, it will be created
|
||||
"""
|
||||
Task.start(deployment, config, task)
|
||||
|
||||
|
||||
@utils.log_deprecated("Use api.Task.abort() instead of "
|
||||
"api.abort_task()", rally_version="0.0.2")
|
||||
def abort_task(task_uuid):
|
||||
"""Abort running task."""
|
||||
Task.abort(task_uuid)
|
||||
|
||||
|
||||
@utils.log_deprecated("Use api.Task.delete() instead of "
|
||||
"api.delete_task()", rally_version="0.0.2")
|
||||
def delete_task(task_uuid, force=False):
|
||||
"""Delete the task.
|
||||
|
||||
:param task_uuid: The UUID of the task.
|
||||
:param force: If set to True, then delete the task despite to the
|
||||
status.
|
||||
:raises: :class:`rally.exceptions.TaskInvalidStatus` when the
|
||||
status of the task is not FINISHED and the force argument
|
||||
if not True
|
||||
"""
|
||||
Task.delete(task_uuid, force)
|
||||
|
||||
|
||||
@utils.log_deprecated("Use api.Verification.verify() instead of "
|
||||
"api.verify()", rally_version="0.0.2")
|
||||
def verify(deployment, set_name, regex, tempest_config):
|
||||
"""Start verifying.
|
||||
|
||||
:param deployment: UUID or name of a deployment.
|
||||
:param set_name: Valid name of tempest test set.
|
||||
:param regex: Regular expression of test
|
||||
:param tempest_config: User specified Tempest config file
|
||||
:returns: Verification object
|
||||
"""
|
||||
return Verification.verify(deployment, set_name, regex, tempest_config)
|
||||
|
||||
|
||||
@utils.log_deprecated("Use api.Verification.install_tempest() instead of "
|
||||
"api.install_tempest()", rally_version="0.0.2")
|
||||
def install_tempest(deployment, source):
|
||||
"""Install Tempest.
|
||||
|
||||
:param deployment: UUID or name of the deployment
|
||||
:param source: Source to fetch Tempest from
|
||||
"""
|
||||
Verification.install_tempest(deployment, source)
|
||||
|
@ -127,9 +127,6 @@ class DeploymentCommands(object):
|
||||
if do_use:
|
||||
self.use(deployment["uuid"])
|
||||
|
||||
@cliutils.deprecated_args(
|
||||
"--uuid", dest="deployment", type=str,
|
||||
required=False, help="UUID of the deployment.")
|
||||
@cliutils.args("--deployment", dest="deployment", type=str,
|
||||
required=False, help="UUID or name of a deployment.")
|
||||
@envutils.with_default_deployment()
|
||||
@ -143,9 +140,6 @@ class DeploymentCommands(object):
|
||||
"""
|
||||
api.Deployment.recreate(deployment)
|
||||
|
||||
@cliutils.deprecated_args(
|
||||
"--uuid", dest="deployment", type=str,
|
||||
required=False, help="UUID of the deployment.")
|
||||
@cliutils.args("--deployment", dest="deployment", type=str,
|
||||
required=False, help="UUID or name of a deployment.")
|
||||
@envutils.with_default_deployment()
|
||||
@ -180,9 +174,6 @@ class DeploymentCommands(object):
|
||||
"To create a new deployment, use:"
|
||||
"\nrally deployment create"))
|
||||
|
||||
@cliutils.deprecated_args(
|
||||
"--uuid", dest="deployment", type=str,
|
||||
required=False, help="UUID of the deployment.")
|
||||
@cliutils.args("--deployment", dest="deployment", type=str,
|
||||
required=False, help="UUID or name of a deployment.")
|
||||
@envutils.with_default_deployment()
|
||||
@ -199,9 +190,6 @@ class DeploymentCommands(object):
|
||||
result = deploy["config"]
|
||||
print(json.dumps(result, sort_keys=True, indent=4))
|
||||
|
||||
@cliutils.deprecated_args(
|
||||
"--uuid", dest="deployment", type=str,
|
||||
required=False, help="UUID of the deployment.")
|
||||
@cliutils.args("--deployment", dest="deployment", type=str,
|
||||
required=False, help="UUID or name of a deployment.")
|
||||
@envutils.with_default_deployment()
|
||||
@ -226,9 +214,6 @@ class DeploymentCommands(object):
|
||||
table_rows.append(utils.Struct(**dict(zip(headers, data))))
|
||||
cliutils.print_list(table_rows, headers)
|
||||
|
||||
@cliutils.deprecated_args(
|
||||
"--uuid", dest="deployment", type=str,
|
||||
required=False, help="UUID of the deployment.")
|
||||
@cliutils.args("--deployment", dest="deployment", type=str,
|
||||
required=False, help="UUID or name of a deployment.")
|
||||
@envutils.with_default_deployment()
|
||||
|
@ -46,9 +46,6 @@ class ShowCommands(object):
|
||||
|
||||
return endpoints + deployment.get("users", [])
|
||||
|
||||
@cliutils.deprecated_args(
|
||||
"--deploy-id", dest="deployment", type=str,
|
||||
required=False, help="UUID of the deployment.")
|
||||
@cliutils.args("--deployment", dest="deployment", type=str,
|
||||
required=False, help="UUID or name of a deployment")
|
||||
@envutils.with_default_deployment(cli_arg_name="deployment")
|
||||
@ -81,9 +78,6 @@ class ShowCommands(object):
|
||||
formatters=formatters,
|
||||
mixed_case_fields=mixed_case_fields)
|
||||
|
||||
@cliutils.deprecated_args(
|
||||
"--deploy-id", dest="deployment", type=str,
|
||||
required=False, help="UUID of the deployment.")
|
||||
@cliutils.args("--deployment", dest="deployment", type=str,
|
||||
required=False, help="UUID or name of a deployment")
|
||||
@envutils.with_default_deployment(cli_arg_name="deployment")
|
||||
@ -115,9 +109,6 @@ class ShowCommands(object):
|
||||
formatters=formatters,
|
||||
mixed_case_fields=mixed_case_fields)
|
||||
|
||||
@cliutils.deprecated_args(
|
||||
"--deploy-id", dest="deployment", type=str,
|
||||
required=False, help="UUID of the deployment.")
|
||||
@cliutils.args("--deployment", dest="deployment", type=str,
|
||||
required=False, help="UUID or name of a deployment")
|
||||
@envutils.with_default_deployment(cli_arg_name="deployment")
|
||||
@ -141,9 +132,6 @@ class ShowCommands(object):
|
||||
fields=headers,
|
||||
mixed_case_fields=mixed_case_fields)
|
||||
|
||||
@cliutils.deprecated_args(
|
||||
"--deploy-id", dest="deployment", type=str,
|
||||
required=False, help="UUID of the deployment.")
|
||||
@cliutils.args("--deployment", dest="deployment", type=str,
|
||||
required=False, help="UUID or name of a deployment")
|
||||
@envutils.with_default_deployment(cli_arg_name="deployment")
|
||||
@ -168,9 +156,6 @@ class ShowCommands(object):
|
||||
fields=headers,
|
||||
mixed_case_fields=mixed_case_fields)
|
||||
|
||||
@cliutils.deprecated_args(
|
||||
"--deploy-id", dest="deployment", type=str,
|
||||
required=False, help="UUID of the deployment.")
|
||||
@cliutils.args("--deployment", dest="deployment", type=str,
|
||||
required=False, help="UUID or name of a deployment")
|
||||
@envutils.with_default_deployment(cli_arg_name="deployment")
|
||||
|
@ -120,9 +120,6 @@ class TaskCommands(object):
|
||||
file=sys.stderr)
|
||||
raise FailedToLoadTask()
|
||||
|
||||
@cliutils.deprecated_args(
|
||||
"--deploy-id", dest="deployment", type=str,
|
||||
required=False, help="UUID of the deployment.")
|
||||
@cliutils.args("--deployment", type=str, dest="deployment",
|
||||
required=False, help="UUID or name of the deployment")
|
||||
@cliutils.args("--task", "--filename",
|
||||
@ -163,9 +160,6 @@ class TaskCommands(object):
|
||||
print(e)
|
||||
return(1)
|
||||
|
||||
@cliutils.deprecated_args(
|
||||
"--deploy-id", dest="deployment", type=str,
|
||||
required=False, help="UUID of the deployment.")
|
||||
@cliutils.args("--deployment", type=str, dest="deployment",
|
||||
required=False, help="UUID or name of the deployment")
|
||||
@cliutils.args("--task", "--filename", help="Path to the input task file")
|
||||
@ -522,9 +516,6 @@ class TaskCommands(object):
|
||||
@cliutils.args("--junit", dest="out_format",
|
||||
action="store_const", const="junit",
|
||||
help="Generate the report in the JUnit format.")
|
||||
@cliutils.deprecated_args(
|
||||
"--uuid", dest="tasks", nargs="+",
|
||||
help="uuids of tasks or json files with task results")
|
||||
@envutils.default_from_global("tasks", envutils.ENV_TASK, "--uuid")
|
||||
@cliutils.suppress_warnings
|
||||
def report(self, tasks=None, out=None, open_it=False, out_format="html"):
|
||||
|
@ -1,72 +0,0 @@
|
||||
# Copyright 2013: Mirantis Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
""" Rally command: use """
|
||||
|
||||
from rally.cli import cliutils
|
||||
from rally.cli.commands import deployment as cli_deployment
|
||||
from rally.cli.commands import task
|
||||
from rally.cli.commands import verify
|
||||
from rally.common import log as logging
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class UseCommands(object):
|
||||
"""Set of commands that allow you to set an active deployment and task.
|
||||
|
||||
Active deployment and task allow you not to specify deployment UUID and
|
||||
task UUID in the commands requiring this parameter.
|
||||
"""
|
||||
|
||||
@cliutils.deprecated_args(
|
||||
"--uuid", dest="deployment", type=str,
|
||||
required=False, help="UUID of the deployment.")
|
||||
@cliutils.deprecated_args(
|
||||
"--name", dest="deployment", type=str,
|
||||
required=False, help="Name of the deployment.")
|
||||
@cliutils.args("--deployment", type=str, dest="deployment",
|
||||
help="UUID or name of the deployment")
|
||||
def deployment(self, deployment=None):
|
||||
"""Set active deployment.
|
||||
|
||||
:param deployment: UUID or name of a deployment
|
||||
"""
|
||||
LOG.warning("Deprecated command 'rally use deployment', "
|
||||
"'rally deployment use' should be used instead.")
|
||||
cli_deployment.DeploymentCommands().use(deployment)
|
||||
|
||||
@cliutils.args("--uuid", type=str, dest="task_id", required=False,
|
||||
help="UUID of the task")
|
||||
def task(self, task_id):
|
||||
"""Set active task.
|
||||
|
||||
:param task_id: a UUID of task
|
||||
"""
|
||||
LOG.warning("Deprecated command 'rally use task', "
|
||||
"'rally task use' should be used instead.")
|
||||
task.TaskCommands().use(task_id)
|
||||
|
||||
@cliutils.args("--uuid", type=str, dest="verification_id", required=False,
|
||||
help="UUID of the verification")
|
||||
def verification(self, verification_id):
|
||||
"""Set active verification.
|
||||
|
||||
:param verification_id: a UUID of verification
|
||||
"""
|
||||
LOG.warning("Deprecated command 'rally use verification', "
|
||||
"'rally verify use' should be used instead.")
|
||||
verify.VerifyCommands.use(verification_id)
|
@ -41,9 +41,6 @@ class VerifyCommands(object):
|
||||
OpenStack live cloud.
|
||||
"""
|
||||
|
||||
@cliutils.deprecated_args(
|
||||
"--deploy-id", dest="deployment", type=str,
|
||||
required=False, help="UUID of the deployment.")
|
||||
@cliutils.args("--deployment", dest="deployment", type=str,
|
||||
required=False, help="UUID or name of a deployment.")
|
||||
@cliutils.args("--set", dest="set_name", type=str, required=False,
|
||||
|
@ -24,7 +24,6 @@ from rally.cli.commands import deployment
|
||||
from rally.cli.commands import info
|
||||
from rally.cli.commands import show
|
||||
from rally.cli.commands import task
|
||||
from rally.cli.commands import use
|
||||
from rally.cli.commands import verify
|
||||
|
||||
|
||||
@ -33,7 +32,6 @@ categories = {
|
||||
"info": info.InfoCommands,
|
||||
"show": show.ShowCommands,
|
||||
"task": task.TaskCommands,
|
||||
"use": use.UseCommands,
|
||||
"verify": verify.VerifyCommands
|
||||
}
|
||||
|
||||
|
@ -37,9 +37,6 @@ class DBCommands(object):
|
||||
class TempestCommands(object):
|
||||
"""Commands for Tempest management."""
|
||||
|
||||
@cliutils.deprecated_args(
|
||||
"--deploy-id", dest="deployment", type=str,
|
||||
required=False, help="UUID of the deployment.")
|
||||
@cliutils.args("--deployment", type=str, dest="deployment",
|
||||
required=False, help="UUID or name of the deployment")
|
||||
@cliutils.args("--source", type=str, dest="source",
|
||||
|
@ -21,7 +21,7 @@ class Endpoint(object):
|
||||
def __init__(self, auth_url, username, password, tenant_name=None,
|
||||
permission=consts.EndpointPermission.USER,
|
||||
region_name=None, endpoint_type=consts.EndpointType.PUBLIC,
|
||||
admin_port=None, domain_name=None, endpoint=None,
|
||||
domain_name=None, endpoint=None,
|
||||
user_domain_name="Default", admin_domain_name="Default",
|
||||
project_domain_name="Default",
|
||||
https_insecure=None, https_cacert=None):
|
||||
@ -39,10 +39,6 @@ class Endpoint(object):
|
||||
self.endpoint = endpoint
|
||||
self.insecure = https_insecure
|
||||
self.cacert = https_cacert
|
||||
if admin_port:
|
||||
import warnings
|
||||
warnings.warn("'admin_port' argument is deprecated and will "
|
||||
"be ignored.")
|
||||
|
||||
def to_dict(self, include_permission=False):
|
||||
dct = {"auth_url": self.auth_url, "username": self.username,
|
||||
|
@ -24,30 +24,6 @@ from rally.common.i18n import _
|
||||
from rally import consts
|
||||
|
||||
|
||||
@sla.configure(name="max_failure_percent")
|
||||
class FailureRateDeprecated(sla.SLA):
|
||||
"""[Deprecated] Failure rate in percents."""
|
||||
CONFIG_SCHEMA = {"type": "number", "minimum": 0.0, "maximum": 100.0}
|
||||
|
||||
def __init__(self, criterion_value):
|
||||
super(FailureRateDeprecated, self).__init__(criterion_value)
|
||||
self.errors = 0
|
||||
self.total = 0
|
||||
self.error_rate = 0.0
|
||||
|
||||
def add_iteration(self, iteration):
|
||||
self.total += 1
|
||||
if iteration["error"]:
|
||||
self.errors += 1
|
||||
self.error_rate = self.errors * 100.0 / self.total
|
||||
self.success = self.error_rate <= self.criterion_value
|
||||
return self.success
|
||||
|
||||
def details(self):
|
||||
return (_("Maximum failure rate %s%% <= %s%% - %s") %
|
||||
(self.criterion_value, self.error_rate, self.status()))
|
||||
|
||||
|
||||
@sla.configure(name="failure_rate")
|
||||
class FailureRate(sla.SLA):
|
||||
"""Failure rate minimum and maximum in percents."""
|
||||
|
@ -301,17 +301,6 @@ class CinderVolumes(utils.CinderScenario,
|
||||
:param kwargs: Optional parameters used during volume
|
||||
snapshot creation.
|
||||
"""
|
||||
if "min_size" in kwargs or "max_size" in kwargs:
|
||||
import warnings
|
||||
warnings.warn("'min_size' and 'max_size' arguments "
|
||||
"are deprecated. You should use 'size', with "
|
||||
"keys 'min' and 'max' instead.")
|
||||
if "volume_size" in kwargs:
|
||||
import warnings
|
||||
warnings.warn("'volume_size' argument is deprecated. You should "
|
||||
"use 'size' instead.")
|
||||
size = kwargs["volume_size"]
|
||||
|
||||
if size is None:
|
||||
size = {"min": 1, "max": 5}
|
||||
selected_type = None
|
||||
@ -362,12 +351,6 @@ class CinderVolumes(utils.CinderScenario,
|
||||
:param kwargs: Optional parameters used during volume
|
||||
snapshot creation.
|
||||
"""
|
||||
if "volume_size" in kwargs:
|
||||
import warnings
|
||||
warnings.warn("'volume_size' argument is deprecated. You should "
|
||||
"use 'size' instead.")
|
||||
size = kwargs["volume_size"]
|
||||
|
||||
if size is None:
|
||||
size = {"min": 1, "max": 5}
|
||||
if nested_level is None:
|
||||
|
@ -1,75 +0,0 @@
|
||||
# Copyright 2014: Mirantis Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import re
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
|
||||
from rally.cli import envutils
|
||||
from tests.functional import utils
|
||||
|
||||
|
||||
class CliUtilsTestCase(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(CliUtilsTestCase, self).setUp()
|
||||
self.rally = utils.Rally()
|
||||
|
||||
def _get_deployment_uuid(self, output):
|
||||
return re.search(
|
||||
r"Using deployment: (?P<uuid>[0-9a-f\-]{36})",
|
||||
output).group("uuid")
|
||||
|
||||
def test_missing_argument(self):
|
||||
with self.assertRaises(utils.RallyCliError) as e:
|
||||
self.rally("use task")
|
||||
self.assertIn("--uuid", e.exception.output)
|
||||
|
||||
def test_deployment(self):
|
||||
with mock.patch.dict("os.environ", utils.TEST_ENV):
|
||||
output = self.rally(
|
||||
"deployment create --name t_create_env1 --fromenv")
|
||||
uuid = self._get_deployment_uuid(output)
|
||||
self.rally("deployment create --name t_create_env2 --fromenv")
|
||||
self.rally("use deployment --deployment %s" % uuid)
|
||||
current_deployment = envutils.get_global("RALLY_DEPLOYMENT")
|
||||
self.assertEqual(uuid, current_deployment)
|
||||
|
||||
def test_task(self):
|
||||
cfg = {
|
||||
"Dummy.dummy_random_fail_in_atomic": [
|
||||
{
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
"times": 100,
|
||||
"concurrency": 5
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
with mock.patch.dict("os.environ", utils.TEST_ENV):
|
||||
deployment_id = envutils.get_global("RALLY_DEPLOYMENT")
|
||||
config = utils.TaskConfig(cfg)
|
||||
output = self.rally(("task start --task %(task_file)s "
|
||||
"--deployment %(deployment_id)s") %
|
||||
{"task_file": config.filename,
|
||||
"deployment_id": deployment_id})
|
||||
result = re.search(
|
||||
r"(?P<uuid>[0-9a-f\-]{36}): started", output)
|
||||
uuid = result.group("uuid")
|
||||
self.rally("use task --uuid %s" % uuid)
|
||||
current_task = envutils.get_global("RALLY_TASK")
|
||||
self.assertEqual(uuid, current_task)
|
@ -1,42 +0,0 @@
|
||||
# Copyright 2013: Mirantis Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
|
||||
from rally.cli.commands import use
|
||||
from tests.unit import test
|
||||
|
||||
MOD = "rally.cli.commands.use."
|
||||
|
||||
|
||||
class UseCommandsTestCase(test.TestCase):
|
||||
def setUp(self):
|
||||
super(UseCommandsTestCase, self).setUp()
|
||||
self.use = use.UseCommands()
|
||||
|
||||
@mock.patch("rally.cli.commands.deployment.DeploymentCommands.use")
|
||||
def test_deployment(self, mock_deployment_use):
|
||||
self.use.deployment("fake_id")
|
||||
mock_deployment_use.assert_called_once_with("fake_id")
|
||||
|
||||
@mock.patch("rally.cli.commands.task.TaskCommands.use")
|
||||
def test_task(self, mock_task_use):
|
||||
self.use.task("fake_id")
|
||||
mock_task_use.assert_called_once_with("fake_id")
|
||||
|
||||
@mock.patch("rally.cli.commands.verify.VerifyCommands.use")
|
||||
def test_verification(self, mock_verify_use):
|
||||
self.use.verification("fake_id")
|
||||
mock_verify_use.assert_called_once_with("fake_id")
|
@ -23,7 +23,6 @@ from rally.cli.commands import deployment
|
||||
from rally.cli.commands import info
|
||||
from rally.cli.commands import show
|
||||
from rally.cli.commands import task
|
||||
from rally.cli.commands import use
|
||||
from rally.cli.commands import verify
|
||||
from rally import exceptions
|
||||
from tests.unit import test
|
||||
@ -42,7 +41,6 @@ class CliUtilsTestCase(test.TestCase):
|
||||
"info": info.InfoCommands,
|
||||
"show": show.ShowCommands,
|
||||
"task": task.TaskCommands,
|
||||
"use": use.UseCommands,
|
||||
"verify": verify.VerifyCommands
|
||||
}
|
||||
|
||||
|
@ -37,25 +37,6 @@ class SLAPluginTestCase(test.TestCase):
|
||||
{"test_criterion": 42.0})
|
||||
|
||||
|
||||
class FailureRateDeprecatedTestCase(test.TestCase):
|
||||
|
||||
def test_result(self):
|
||||
sla1 = failure_rate.FailureRateDeprecated(75.0)
|
||||
sla2 = failure_rate.FailureRateDeprecated(25.0)
|
||||
# 50% failure rate
|
||||
for sla in [sla1, sla2]:
|
||||
sla.add_iteration({"error": ["error"]})
|
||||
sla.add_iteration({"error": []})
|
||||
self.assertTrue(sla1.result()["success"]) # 50% < 75.0%
|
||||
self.assertFalse(sla2.result()["success"]) # 50% > 25.0%
|
||||
self.assertEqual("Passed", sla1.status())
|
||||
self.assertEqual("Failed", sla2.status())
|
||||
|
||||
def test_result_no_iterations(self):
|
||||
sla = failure_rate.FailureRateDeprecated(10.0)
|
||||
self.assertTrue(sla.result()["success"])
|
||||
|
||||
|
||||
class FailureRateTestCase(test.TestCase):
|
||||
|
||||
def test_config_schema(self):
|
||||
|
@ -325,68 +325,3 @@ class VerificationAPITestCase(BaseDeploymentTestCase):
|
||||
tmp_file)
|
||||
self.tempest.install.assert_called_once_with()
|
||||
mock_move.assert_called_once_with(tmp_file, fake_conf)
|
||||
|
||||
|
||||
class DeprecatedAPITestCase(test.TestCase):
|
||||
@mock.patch("rally.api.Deployment.create",
|
||||
return_value="created_deployment")
|
||||
def test_create_deploy(self, mock_deployment_create):
|
||||
deployment = api.create_deploy(FAKE_DEPLOYMENT_CONFIG, "deployment")
|
||||
mock_deployment_create.assert_called_once_with(FAKE_DEPLOYMENT_CONFIG,
|
||||
"deployment")
|
||||
self.assertEqual("created_deployment", deployment)
|
||||
|
||||
@mock.patch("rally.api.Deployment.destroy")
|
||||
def test_destroy_deploy(self, mock_deployment_destroy):
|
||||
api.destroy_deploy("deployment")
|
||||
mock_deployment_destroy.assert_called_once_with("deployment")
|
||||
|
||||
@mock.patch("rally.api.Deployment.recreate")
|
||||
def test_recreate_deploy(self, mock_deployment_recreate):
|
||||
api.recreate_deploy("deployment")
|
||||
mock_deployment_recreate.assert_called_once_with("deployment")
|
||||
|
||||
@mock.patch("rally.api.Task.render_template",
|
||||
return_value="rendered_template")
|
||||
def test_task_template_render(self, mock_task_template_render):
|
||||
result = api.task_template_render("template", a=2, b=3)
|
||||
mock_task_template_render.assert_called_once_with("template", a=2, b=3)
|
||||
self.assertEqual("rendered_template", result)
|
||||
|
||||
@mock.patch("rally.api.Task.create", return_value="created_task")
|
||||
def test_create_task(self, mock_task_create):
|
||||
task = api.create_task("deployment", "tag")
|
||||
mock_task_create.assert_called_once_with("deployment", "tag")
|
||||
self.assertEqual("created_task", task)
|
||||
|
||||
@mock.patch("rally.api.Task.validate")
|
||||
def test_task_validate(self, mock_task_validate):
|
||||
api.task_validate("deployment", "config")
|
||||
mock_task_validate.assert_called_once_with("deployment", "config")
|
||||
|
||||
@mock.patch("rally.api.Task.start")
|
||||
def test_start_task(self, mock_task_start):
|
||||
api.start_task("deployment", "config", "task")
|
||||
mock_task_start.assert_called_once_with("deployment", "config", "task")
|
||||
|
||||
@mock.patch("rally.api.Task.abort")
|
||||
def test_abort_task(self, mock_task_abort):
|
||||
api.abort_task("task_uuid")
|
||||
mock_task_abort.assert_called_once_with("task_uuid")
|
||||
|
||||
@mock.patch("rally.api.Task.delete")
|
||||
def test_delete_task(self, mock_task_delete):
|
||||
api.delete_task("task_uuid", force=True)
|
||||
mock_task_delete.assert_called_once_with("task_uuid", True)
|
||||
|
||||
@mock.patch("rally.api.Verification.verify")
|
||||
def test_verify(self, mock_verification_verify):
|
||||
api.verify("deployment", "set", "regex", "tempest_config")
|
||||
mock_verification_verify.assert_called_once_with(
|
||||
"deployment", "set", "regex", "tempest_config")
|
||||
|
||||
@mock.patch("rally.api.Verification.install_tempest")
|
||||
def test_install_tempest(self, mock_verification_install_tempest):
|
||||
api.install_tempest("deployment", "source")
|
||||
mock_verification_install_tempest.assert_called_once_with(
|
||||
"deployment", "source")
|
||||
|
Loading…
Reference in New Issue
Block a user