Remove a bunch of deprecated stuff from CLI
* *rally task sla_check* command was deprecated in Rally 0.8.0 in favor of *rally task sla-check*. * *rally-manage db* command (and the whole *rally-manage* entry-point) was deprecated in Rally 0.10.0 in favor of *rally db* command. * *--namespace* argument was deprecated in Rally 0.10.0 in favor of *--platform* which has better meaning. Affected commands: *rally plugin show*, *rally plugin list*, *rally verify list-plugins*, *rally verify create-verifier*. * *--tasks* argument of *rally task report* command and *--task* argument of *rally task use* command were deprecated in Rally 0.10.0 in favor of unified *--uuid* argument. * *--junit* argument of *rally task report* command is deprecated in Rally 0.10.0 in favor of *rally task export --type junit-xml* Also, this patch: * covers @deprecated_args cli decorator with unit teststo pass cover job. * switches functional tests to use testtools library instead of unittest (for unificaiton with our unit tests) Change-Id: Icf5651117b20a8ecfe6a3e5f42eb3a4e569e0618
This commit is contained in:
parent
60d39f3a37
commit
8d54b0e235
@ -17,11 +17,35 @@ Changelog
|
||||
.. Release notes for existing releases are MUTABLE! If there is something that
|
||||
was missed or can be improved, feel free to change it!
|
||||
|
||||
[unreleased]
|
||||
------------
|
||||
|
||||
Removed
|
||||
~~~~~~~
|
||||
|
||||
* *rally task sla_check* command was deprecated in Rally 0.8.0 in favor of
|
||||
*rally task sla-check*.
|
||||
|
||||
* *rally-manage db* command (and the whole *rally-manage* entry-point) was
|
||||
deprecated in Rally 0.10.0 in favor of *rally db* command.
|
||||
|
||||
* *--namespace* argument was deprecated in Rally 0.10.0 in favor of
|
||||
*--platform* which has better meaning.
|
||||
Affected commands: *rally plugin show*, *rally plugin list*,
|
||||
*rally verify list-plugins*, *rally verify create-verifier*.
|
||||
|
||||
* *--tasks* argument of *rally task report* command and *--task* argument of
|
||||
*rally task use* command were deprecated in Rally 0.10.0 in favor of
|
||||
unified *--uuid* argument.
|
||||
|
||||
* *--junit* argument of *rally task report* command is deprecated in
|
||||
Rally 0.10.0 in favor of *rally task export --type junit-xml*
|
||||
|
||||
[1.6.0] - 2019-06-19
|
||||
--------------------
|
||||
|
||||
Added
|
||||
~~~~~~~
|
||||
~~~~~
|
||||
|
||||
A list of tests to skip while running verification now supports regular
|
||||
expressions.
|
||||
|
@ -52,7 +52,6 @@ _rally()
|
||||
OPTS["task_report"]="--out --open --html --html-static --json --uuid --deployment"
|
||||
OPTS["task_results"]="--uuid"
|
||||
OPTS["task_sla-check"]="--uuid --json"
|
||||
OPTS["task_sla_check"]="--uuid --json"
|
||||
OPTS["task_start"]="--deployment --task --task-args --task-args-file --tag --no-use --abort-on-sla-failure"
|
||||
OPTS["task_status"]="--uuid"
|
||||
OPTS["task_trends"]="--out --open --tasks --html-static"
|
||||
@ -106,4 +105,4 @@ _rally()
|
||||
return 0
|
||||
}
|
||||
|
||||
complete -o filenames -F _rally rally
|
||||
complete -o filenames -F _rally rally
|
@ -42,8 +42,6 @@ class PluginCommands(object):
|
||||
help="Plugin name.")
|
||||
@cliutils.args("--platform", dest="platform", type=str,
|
||||
help="Plugin platform.")
|
||||
@cliutils.deprecated_args("--namespace", dest="platform",
|
||||
release="0.10.0", alternative="--platform")
|
||||
@plugins.ensure_plugins_are_loaded
|
||||
def show(self, api, name, platform=None):
|
||||
"""Show detailed information about a Rally plugin."""
|
||||
@ -88,8 +86,6 @@ class PluginCommands(object):
|
||||
@cliutils.args(
|
||||
"--platform", dest="platform", type=str,
|
||||
help="List only plugins that are in the specified platform.")
|
||||
@cliutils.deprecated_args("--namespace", dest="platform",
|
||||
release="0.10.0", alternative="--platform")
|
||||
@cliutils.args(
|
||||
"--plugin-base", dest="base_cls", type=str,
|
||||
help="Plugin base class.")
|
||||
|
@ -836,8 +836,6 @@ class TaskCommands(object):
|
||||
output_dest=kwargs.get("out"),
|
||||
open_it=kwargs.get("open_it", False))
|
||||
|
||||
@cliutils.deprecated_args("--tasks", dest="tasks", nargs="+",
|
||||
release="0.10.0", alternative="--uuid")
|
||||
@cliutils.args("--out", metavar="<path>",
|
||||
type=str, dest="out", required=False,
|
||||
help="Report destination. Can be a path to a file (in case"
|
||||
@ -851,11 +849,6 @@ class TaskCommands(object):
|
||||
action="store_const", const="html-static")
|
||||
@cliutils.args("--json", dest="out_format",
|
||||
action="store_const", const="json")
|
||||
@cliutils.deprecated_args("--junit", dest="out_format",
|
||||
action="store_const", const="junit-xml",
|
||||
release="0.10.0",
|
||||
alternative=("rally task export "
|
||||
"--type junit-xml"))
|
||||
@cliutils.args("--uuid", dest="tasks", nargs="+", type=str,
|
||||
help="UUIDs of tasks or json reports of tasks")
|
||||
@cliutils.args("--deployment", dest="deployment", type=str,
|
||||
@ -895,17 +888,6 @@ class TaskCommands(object):
|
||||
else:
|
||||
_delete_single_task(task_id, force)
|
||||
|
||||
@cliutils.args("--uuid", type=str, dest="task_id", help="UUID of task.")
|
||||
@cliutils.args("--json", dest="tojson",
|
||||
action="store_true",
|
||||
help="Output in JSON format.")
|
||||
@envutils.with_default_task_id
|
||||
@cliutils.alias("sla_check")
|
||||
def sla_check_deprecated(self, api, task_id=None, tojson=False):
|
||||
"""DEPRECATED since Rally 0.8.0, use `rally task sla-check` instead."""
|
||||
|
||||
return self.sla_check(api, task_id=task_id, tojson=tojson)
|
||||
|
||||
@cliutils.args("--uuid", type=str, dest="task_id", help="UUID of task.")
|
||||
@cliutils.args("--json", dest="tojson",
|
||||
action="store_true",
|
||||
@ -938,8 +920,6 @@ class TaskCommands(object):
|
||||
|
||||
@cliutils.args("--uuid", type=str, dest="task_id",
|
||||
help="UUID of the task")
|
||||
@cliutils.deprecated_args("--task", dest="task_id", type=str,
|
||||
release="0.2.0", alternative="--uuid")
|
||||
def use(self, api, task_id):
|
||||
"""Set active task."""
|
||||
|
||||
|
@ -91,8 +91,6 @@ class VerifyCommands(object):
|
||||
|
||||
@cliutils.args("--platform", dest="platform", type=str,
|
||||
help="Requried patform (e.g. openstack).")
|
||||
@cliutils.deprecated_args("--namespace", dest="platform",
|
||||
release="0.10.0", alternative="--platform")
|
||||
@plugins.ensure_plugins_are_loaded
|
||||
def list_plugins(self, api, platform=None):
|
||||
"""List all plugins for verifiers management."""
|
||||
@ -120,8 +118,6 @@ class VerifyCommands(object):
|
||||
help="Verifier plugin platform. Should be specified in "
|
||||
"case of two verifier plugins with equal names but "
|
||||
"in different platforms.")
|
||||
@cliutils.deprecated_args("--namespace", dest="platform",
|
||||
release="0.10.0", alternative="--platform")
|
||||
@cliutils.args("--source", dest="source", type=str, required=False,
|
||||
help="Path or URL to the repo to clone verifier from.")
|
||||
@cliutils.args("--version", dest="version", type=str, required=False,
|
||||
|
@ -1,30 +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 sys
|
||||
|
||||
from rally.cli import cliutils
|
||||
from rally.cli.commands import db
|
||||
|
||||
|
||||
def main():
|
||||
categories = {"db": db.DBCommands}
|
||||
print("`rally-manage db <command>` was deprecated since 0.10.0 version "
|
||||
"and is going to be removed soon. Please use `rally db <command>`.")
|
||||
return cliutils.run(sys.argv, categories)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
@ -33,7 +33,6 @@ data_files =
|
||||
[entry_points]
|
||||
console_scripts =
|
||||
rally = rally.cli.main:main
|
||||
rally-manage = rally.cli.manage:main
|
||||
oslo.config.opts =
|
||||
rally = rally.common.opts:list_opts
|
||||
oslo.config.opts.defaults =
|
||||
|
@ -18,10 +18,10 @@ import os
|
||||
import re
|
||||
import threading
|
||||
import time
|
||||
import unittest
|
||||
|
||||
import jsonschema
|
||||
import mock
|
||||
import testtools
|
||||
|
||||
from rally import api
|
||||
from tests.functional import utils
|
||||
@ -30,7 +30,7 @@ from tests.functional import utils
|
||||
FAKE_TASK_UUID = "87ab639d-4968-4638-b9a1-07774c32484a"
|
||||
|
||||
|
||||
class TaskTestCase(unittest.TestCase):
|
||||
class TaskTestCase(testtools.TestCase):
|
||||
|
||||
def _get_sample_task_config(self):
|
||||
return {
|
||||
@ -156,11 +156,9 @@ class TaskTestCase(unittest.TestCase):
|
||||
]
|
||||
}
|
||||
config = utils.TaskConfig(cfg)
|
||||
try:
|
||||
# it should be failed due to Dummy.dummy_exception
|
||||
rally("task start --task %s" % config.filename)
|
||||
except utils.RallyCliError:
|
||||
pass
|
||||
# it should be failed due to Dummy.dummy_exception
|
||||
self.assertRaises(utils.RallyCliError,
|
||||
rally, "task start --task %s" % config.filename)
|
||||
output = rally("task detailed --filter-by sla-failures")
|
||||
self.assertIn("Dummy.dummy_exception", output)
|
||||
self.assertNotIn("Dummy.dummy_random_action", output)
|
||||
@ -211,10 +209,11 @@ class TaskTestCase(unittest.TestCase):
|
||||
def test_start_with_empty_config(self):
|
||||
rally = utils.Rally()
|
||||
config = utils.TaskConfig(None)
|
||||
with self.assertRaises(utils.RallyCliError) as err:
|
||||
rally("task start --task %s" % config.filename)
|
||||
err = self.assertRaises(
|
||||
utils.RallyCliError,
|
||||
rally, "task start --task %s" % config.filename)
|
||||
self.assertIn("Task config is invalid: `It is empty`",
|
||||
err.exception.output)
|
||||
err.output)
|
||||
|
||||
def test_results(self):
|
||||
rally = utils.Rally()
|
||||
@ -265,10 +264,11 @@ class TaskTestCase(unittest.TestCase):
|
||||
|
||||
def test_report_with_wrong_task_id(self):
|
||||
rally = utils.Rally()
|
||||
self.assertRaises(utils.RallyCliError,
|
||||
rally, "task report --tasks %s" % FAKE_TASK_UUID)
|
||||
self.assertRaises(utils.RallyCliError,
|
||||
rally, "task report --uuid %s" % FAKE_TASK_UUID)
|
||||
e = self.assertRaises(utils.RallyCliError,
|
||||
rally, "task report --uuid %s" % FAKE_TASK_UUID)
|
||||
self.assertIn(
|
||||
"Record for uuid: %s not found in table task" % FAKE_TASK_UUID,
|
||||
str(e))
|
||||
|
||||
def test_sla_check_with_wrong_task_id(self):
|
||||
rally = utils.Rally()
|
||||
@ -999,7 +999,7 @@ class TaskTestCase(unittest.TestCase):
|
||||
result = re.search(
|
||||
r"(?P<uuid>[0-9a-f\-]{36}): started", output)
|
||||
uuid = result.group("uuid")
|
||||
rally("task use --task %s" % uuid)
|
||||
rally("task use --uuid %s" % uuid)
|
||||
current_task = utils.get_global("RALLY_TASK", rally.env)
|
||||
self.assertEqual(uuid, current_task)
|
||||
|
||||
@ -1050,7 +1050,7 @@ class TaskTestCase(unittest.TestCase):
|
||||
self.assertTrue(os.path.exists(html_report))
|
||||
|
||||
|
||||
class SLATestCase(unittest.TestCase):
|
||||
class SLATestCase(testtools.TestCase):
|
||||
|
||||
def _get_sample_task_config(self, max_seconds_per_iteration=4,
|
||||
failure_rate_max=0):
|
||||
@ -1077,9 +1077,10 @@ class SLATestCase(unittest.TestCase):
|
||||
rally = utils.Rally()
|
||||
cfg = self._get_sample_task_config(max_seconds_per_iteration=0.001)
|
||||
config = utils.TaskConfig(cfg)
|
||||
with self.assertRaises(utils.RallyCliError) as err:
|
||||
rally("task start --task %s" % config.filename)
|
||||
output = err.exception.output
|
||||
err = self.assertRaises(
|
||||
utils.RallyCliError,
|
||||
rally, "task start --task %s" % config.filename)
|
||||
output = err.output
|
||||
self.assertIn("At least one workload did not pass SLA criteria.",
|
||||
output)
|
||||
self.assertRaises(utils.RallyCliError, rally, "task sla-check")
|
||||
@ -1103,7 +1104,7 @@ class SLATestCase(unittest.TestCase):
|
||||
self.assertEqual(expected, data)
|
||||
|
||||
|
||||
class SLAExtraFlagsTestCase(unittest.TestCase):
|
||||
class SLAExtraFlagsTestCase(testtools.TestCase):
|
||||
|
||||
def test_abort_on_sla_fail(self):
|
||||
rally = utils.Rally()
|
||||
@ -1135,13 +1136,9 @@ class SLAExtraFlagsTestCase(unittest.TestCase):
|
||||
"detail": mock.ANY,
|
||||
"pos": 0, "status": "FAIL"}
|
||||
]
|
||||
try:
|
||||
rally("task sla-check --json", getjson=True)
|
||||
except utils.RallyCliError as expected_error:
|
||||
self.assertEqual(expected, json.loads(expected_error.output))
|
||||
else:
|
||||
self.fail("`rally task sla-check` command should return non-zero "
|
||||
"exit code")
|
||||
e = self.assertRaises(utils.RallyCliError,
|
||||
rally, "task sla-check --json", getjson=True)
|
||||
self.assertEqual(expected, json.loads(e.output))
|
||||
|
||||
def _test_broken_context(self, runner):
|
||||
rally = utils.Rally()
|
||||
@ -1170,13 +1167,9 @@ class SLAExtraFlagsTestCase(unittest.TestCase):
|
||||
"detail": mock.ANY,
|
||||
"pos": 0, "status": "FAIL"}
|
||||
]
|
||||
try:
|
||||
rally("task sla-check --json", getjson=True)
|
||||
except utils.RallyCliError as expected_error:
|
||||
self.assertEqual(expected, json.loads(expected_error.output))
|
||||
else:
|
||||
self.fail("`rally task sla-check` command should return non-zero "
|
||||
"exit code")
|
||||
e = self.assertRaises(utils.RallyCliError,
|
||||
rally, "task sla-check --json", getjson=True)
|
||||
self.assertEqual(expected, json.loads(e.output))
|
||||
|
||||
def test_broken_context_with_constant_runner(self):
|
||||
self._test_broken_context({"type": "constant",
|
||||
@ -1190,7 +1183,7 @@ class SLAExtraFlagsTestCase(unittest.TestCase):
|
||||
"timeout": 6})
|
||||
|
||||
|
||||
class SLAPerfDegrTestCase(unittest.TestCase):
|
||||
class SLAPerfDegrTestCase(testtools.TestCase):
|
||||
|
||||
def _get_sample_task_config(self, max_degradation=500):
|
||||
return {
|
||||
@ -1219,9 +1212,10 @@ class SLAPerfDegrTestCase(unittest.TestCase):
|
||||
rally = utils.Rally()
|
||||
cfg = self._get_sample_task_config(max_degradation=1)
|
||||
config = utils.TaskConfig(cfg)
|
||||
with self.assertRaises(utils.RallyCliError) as err:
|
||||
rally("task start --task %s" % config.filename)
|
||||
output = err.exception.output
|
||||
err = self.assertRaises(
|
||||
utils.RallyCliError,
|
||||
rally, "task start --task %s" % config.filename)
|
||||
output = err.output
|
||||
self.assertIn("At least one workload did not pass SLA criteria.",
|
||||
output)
|
||||
self.assertRaises(utils.RallyCliError, rally, "task sla-check")
|
||||
@ -1241,7 +1235,7 @@ class SLAPerfDegrTestCase(unittest.TestCase):
|
||||
self.assertEqual(expected, data)
|
||||
|
||||
|
||||
class HookTestCase(unittest.TestCase):
|
||||
class HookTestCase(testtools.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(HookTestCase, self).setUp()
|
||||
|
@ -922,6 +922,28 @@ class ValidateArgsTest(test.TestCase):
|
||||
wrapped = cliutils.alias(cmd_name)
|
||||
self.assertEqual(cmd_name, wrapped(alias_fn).alias)
|
||||
|
||||
def test_deprecated_args(self):
|
||||
def command():
|
||||
pass
|
||||
|
||||
def deprecated_args(func, *args, **kwargs):
|
||||
cliutils.deprecated_args(*args, **kwargs)(func)
|
||||
|
||||
e = self.assertRaises(ValueError, deprecated_args, command,
|
||||
"--argument-name", type="const")
|
||||
self.assertIn("'release' is required keyword argument", str(e))
|
||||
self.assertNotIn("args", command.__dict__)
|
||||
self.assertNotIn("deprecated_args", command.__dict__)
|
||||
|
||||
@cliutils.deprecated_args("--argument-name", type="const", release=777)
|
||||
def command():
|
||||
pass
|
||||
|
||||
self.assertEqual(1, len(command.__dict__.get("args", [])))
|
||||
arg_kwargs = command.__dict__["args"][0][1]
|
||||
self.assertIn("[Deprecated since Rally 777]",
|
||||
arg_kwargs.get("help", ""))
|
||||
|
||||
|
||||
class CategoryParserTestCase(test.TestCase):
|
||||
|
||||
|
@ -1,30 +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 sys
|
||||
|
||||
import mock
|
||||
|
||||
from rally.cli import manage
|
||||
from tests.unit import test
|
||||
|
||||
|
||||
class CmdManageTestCase(test.TestCase):
|
||||
|
||||
@mock.patch("rally.cli.manage.cliutils")
|
||||
def test_main(self, mock_cliutils):
|
||||
manage.main()
|
||||
categories = {"db": manage.db.DBCommands}
|
||||
mock_cliutils.run.assert_called_once_with(sys.argv, categories)
|
Loading…
x
Reference in New Issue
Block a user