diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ad2f7dd84d..33d54a08b7 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -20,13 +20,6 @@ Changelog [unreleased] ------------ -Removed -~~~~~~~ - -* Python 2.7, Python 3.4 and Python 3.5 support -* Devstack plugin. It was deprecated long time ago. rally-openstack project - should be used instead - Changed ~~~~~~~ @@ -38,7 +31,33 @@ Changed * *path_or_url* plugin follows redirects while validating urls now. +Removed +~~~~~~~ + +* Python 2.7, Python 3.4 and Python 3.5 support + +* Devstack plugin. It was deprecated long time ago. rally-openstack project + should be used instead + +* *rally.common.utils.distance* method was deprecated since Rally 0.4.1 + +* *rally.common.utils.format_float_to_str* method was deprecated since + Rally 0.11.2. *rally.utils.strutils.format_float_to_str* should be used + instead. + +* *rally.task.atomic.optional_action_timer* decorator was deprecated since + Rally 0.10.0 + +* *rally.task.hook.Hook* class was deprecated since Rally 0.10.0. + *rally.task.hook.HookAction* should be used instead. + +* *rally.task.trigger* module was deprecated since Rally 0.10.0. + *rally.task.hook.HookTrigger* should be used instead. + +* *rally.common.i18n* module was deprecated since Rally 0.10.0 + Fixed + ~~~~~ * inaccurate calculation of 90 and 95 percentiles in case of 10k+ iterations diff --git a/rally/common/i18n.py b/rally/common/i18n.py deleted file mode 100644 index 30d0b4b167..0000000000 --- a/rally/common/i18n.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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. - -"""oslo.i18n integration module for rally. - -See https://docs.openstack.org/oslo.i18n/latest/user/usage.html . - -""" - -from rally.common import logging - -LOG = logging.getLogger(__name__) -LOG.warning("rally.common.i18n module is deprecated and is going to be " - "removed. Please do not import it.") - - -def _do_nothing(msg): - return msg - - -# The primary translation function using the well-known name "_" -_ = _do_nothing - -# Translators for log levels. -# -# The abbreviated names are meant to reflect the usual use of a short -# name like '_'. The "L" is for "log" and the other letter comes from -# the level. -_LI = _do_nothing -_LW = _do_nothing -_LE = _do_nothing -_LC = _do_nothing diff --git a/rally/common/utils.py b/rally/common/utils.py index f29d12952f..df3d535344 100644 --- a/rally/common/utils.py +++ b/rally/common/utils.py @@ -34,7 +34,6 @@ from six import moves from rally.common import logging from rally import exceptions -from rally.utils import strutils LOG = logging.getLogger(__name__) @@ -192,27 +191,6 @@ def first_index(lst, predicate): return None -@logging.log_deprecated(message="Its not used elsewhere in Rally already.", - rally_version="0.4.1") -def distance(s1, s2): - """Computes the edit distance between two strings. - - The edit distance is the Levenshtein distance. The larger the return value, - the more edits are required to transform one string into the other. - - :param s1: First string to compare - :param s2: Second string to compare - :returns: Integer distance between two strings - """ - n = range(0, len(s1) + 1) - for y in range(1, len(s2) + 1): - l, n = n, [y] - for x in moves.range(1, len(s1) + 1): - n.append(min(l[x] + 1, n[-1] + 1, - l[x - 1] + (s2[y - 1] != s1[x - 1]))) - return n[-1] - - def retry(times, func, *args, **kwargs): """Try to execute multiple times function mitigating exceptions. @@ -686,13 +664,6 @@ class LockedDict(dict): return super(LockedDict, self).clear(*args, **kwargs) -@logging.log_deprecated(message="Its not used elsewhere in Rally already.", - rally_version="0.11.2") -def format_float_to_str(num): - """DEPRECATED. Use rally.utils.strutils.format_float_to_str instead.""" - return strutils.format_float_to_str(num) - - class DequeAsQueue(object): """Allows to use some of Queue methods on collections.deque.""" diff --git a/rally/task/atomic.py b/rally/task/atomic.py index 87bd053a80..6336871a4a 100644 --- a/rally/task/atomic.py +++ b/rally/task/atomic.py @@ -94,43 +94,6 @@ def action_timer(name): return wrap -def optional_action_timer(name, argument_name="atomic_action", default=True): - """Optionally provide measure of execution time. - - Decorates methods of the Scenario class. This provides duration in - seconds of each atomic action. When the decorated function is - called, this inspects the kwarg named by ``argument_name`` and - optionally sets an ActionTimer around the function call. - - The ``atomic_action`` keyword argument does not need to be added - to the function; it will be popped from the kwargs dict by the - wrapper. - - :param name: The name of the timer - :param argument_name: The name of the kwarg to inspect to - determine if a timer should be set. - :param default: Whether or not to set a timer if ``argument_name`` - is not present. - """ - def wrap(func): - @functools.wraps(func) - def func_atomic_actions(self, *args, **kwargs): - LOG.warning("'optional_action_timer' is deprecated " - "since rally v0.10.0." - "Please use action_timer instead, " - "we have improved atomic actions, " - "now do not need to explicitly close " - "original action.") - if kwargs.pop(argument_name, default): - with ActionTimer(self, name): - f = func(self, *args, **kwargs) - else: - f = func(self, *args, **kwargs) - return f - return func_atomic_actions - return wrap - - def merge_atomic_actions(atomic_actions, root=None, depth=0, depth_of_processing=2): """Merge duplicates of atomic actions into one atomic action. diff --git a/rally/task/hook.py b/rally/task/hook.py index c048910c88..aa52aab87b 100644 --- a/rally/task/hook.py +++ b/rally/task/hook.py @@ -245,14 +245,3 @@ class HookTrigger(plugin.Plugin, validation.ValidatablePluginMixin): results["summary"].setdefault(action_result["status"], 0) results["summary"][action_result["status"]] += 1 return results - - -class Hook(HookAction): - """DEPRECATED! USE `rally.task.hook.HookAction` instead.""" - - def __init__(self, *args, **kwargs): - super(Hook, self).__init__(*args, **kwargs) - LOG.warning("Please contact Rally plugin maintainer. The plugin '%s' " - "inherits the deprecated base class(Hook), " - "`rally.task.hook.HookAction` should be used instead." - % self.get_name()) diff --git a/rally/task/trigger.py b/rally/task/trigger.py deleted file mode 100644 index 0441da234d..0000000000 --- a/rally/task/trigger.py +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright 2016: 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. - -from rally.common import logging -from rally.task import hook - -LOG = logging.getLogger(__name__) - - -class Trigger(hook.HookTrigger): - """DEPRECATED!!! USE `rally.task.hook.HookTrigger` instead.""" - - def __init__(self, *args, **kwargs): - super(Trigger, self).__init__(*args, **kwargs) - LOG.warning("Please contact Rally plugin maintainer. The plugin '%s' " - "inherits the deprecated base class(Trigger), " - "`rally.task.hook.HookTrigger` should be used instead." - % self.get_name()) - - @property - def context(self): - action_name, action_cfg = self.hook_cfg["action"] - trigger_name, trigger_cfg = self.hook_cfg["trigger"] - return {"description": self.hook_cfg["description"], - "name": action_name, - "args": action_cfg, - "trigger": {"name": trigger_name, - "args": trigger_cfg}} diff --git a/tests/unit/common/test_i18.py b/tests/unit/common/test_i18.py deleted file mode 100644 index 9b6534f3df..0000000000 --- a/tests/unit/common/test_i18.py +++ /dev/null @@ -1,18 +0,0 @@ -# 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. - -# TODO(boris-42): This is used just to check that i18n.py can be imported -# it should be removed as soon as we remove i18n module - -from rally.common import i18n # noqa diff --git a/tests/unit/common/test_utils.py b/tests/unit/common/test_utils.py index b514652dd7..665e147a46 100644 --- a/tests/unit/common/test_utils.py +++ b/tests/unit/common/test_utils.py @@ -150,29 +150,6 @@ class FirstIndexTestCase(test.TestCase): self.assertIsNone(utils.first_index(lst, lambda e: e == 2)) -class EditDistanceTestCase(test.TestCase): - - def test_distance_empty_strings(self): - dist = utils.distance("", "") - self.assertEqual(0, dist) - - def test_distance_equal_strings(self): - dist = utils.distance("abcde", "abcde") - self.assertEqual(0, dist) - - def test_distance_replacement(self): - dist = utils.distance("abcde", "__cde") - self.assertEqual(2, dist) - - def test_distance_insertion(self): - dist = utils.distance("abcde", "ab__cde") - self.assertEqual(2, dist) - - def test_distance_deletion(self): - dist = utils.distance("abcde", "abc") - self.assertEqual(2, dist) - - class TenantIteratorTestCase(test.TestCase): def test_iterate_per_tenant(self): diff --git a/tests/unit/task/test_atomic.py b/tests/unit/task/test_atomic.py index 4f0dfc48cf..62ab7b0526 100644 --- a/tests/unit/task/test_atomic.py +++ b/tests/unit/task/test_atomic.py @@ -112,42 +112,6 @@ class AtomicActionTestCase(test.TestCase): "started_at": 1, "finished_at": 3}], inst.atomic_actions()) - @mock.patch("rally.task.atomic.LOG.warning") - @mock.patch("time.time", side_effect=[1, 3, 1, 3]) - def test_optional_action_timer_decorator(self, mock_time, - mock_log_warning): - - class TestAtomicTimer(atomic.ActionTimerMixin): - - @atomic.optional_action_timer("some") - def some_func(self, a, b): - return a + b - - @atomic.optional_action_timer("some", argument_name="foo", - default=False) - def other_func(self, a, b): - return a + b - - inst = TestAtomicTimer() - self.assertEqual(5, inst.some_func(2, 3)) - self.assertEqual([{"name": "some", "children": [], - "started_at": 1, "finished_at": 3}], - inst.atomic_actions()) - - inst = TestAtomicTimer() - self.assertEqual(5, inst.some_func(2, 3, atomic_action=False)) - self.assertEqual([], inst.atomic_actions()) - - inst = TestAtomicTimer() - self.assertEqual(5, inst.other_func(2, 3)) - self.assertEqual([], inst.atomic_actions()) - - inst = TestAtomicTimer() - self.assertEqual(5, inst.other_func(2, 3, foo=True)) - self.assertEqual([{"name": "some", "children": [], - "started_at": 1, "finished_at": 3}], - inst.atomic_actions()) - def test_merge_atomic_actions(self): expected = [("foo", {"duration": 2, "count": 1, "children": collections.OrderedDict()}), diff --git a/tests/unit/task/test_trigger.py b/tests/unit/task/test_trigger.py deleted file mode 100644 index bf7086a224..0000000000 --- a/tests/unit/task/test_trigger.py +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright 2016: 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. - -"""Tests for Trigger base class.""" - -import mock - -from rally.task import trigger -from tests.unit import test - - -class TriggerTestCase(test.TestCase): - - def setUp(self): - super(TriggerTestCase, self).setUp() - - @trigger.hook.configure(self.id()) - class DummyTrigger(trigger.Trigger): - def get_listening_event(self): - return "dummy" - - self.addCleanup(DummyTrigger.unregister) - self.DummyTrigger = DummyTrigger - - @mock.patch("rally.task.trigger.LOG.warning") - def test_warning(self, mock_log_warning): - self.DummyTrigger({"trigger": (self.id(), {})}, None, None) - - mock_log_warning.assert_called_once_with( - "Please contact Rally plugin maintainer. The plugin '%s'" - " inherits the deprecated base class(Trigger), " - "`rally.task.hook.HookTrigger` should be used instead." % - self.id()) - - def test_context(self): - action_name = "mega_action" - action_cfg = {"action_arg": "action_value"} - trigger_name = self.id() - trigger_cfg = {"trigger_arg": "trigger_value"} - descr = "descr" - - trigger_obj = self.DummyTrigger({ - "trigger": (trigger_name, trigger_cfg), - "action": (action_name, action_cfg), - "description": descr}, None, None) - - self.assertEqual( - {"name": action_name, - "args": action_cfg, - "trigger": {"name": trigger_name, - "args": trigger_cfg}, - "description": descr}, trigger_obj.context)