From 5f79ab87c702c1b5f4899dfe273728a83497879c Mon Sep 17 00:00:00 2001 From: Sean Mooney Date: Tue, 22 Oct 2024 19:31:14 +0100 Subject: [PATCH] [pre-commit] fix typos and configure codespell This chanage enabled codespell in precommit and fixes the existing typos. A followup commit will enable this in tox and ci. Change-Id: I0a11bcd5a88247a48d3437525fc8a3cb3cdd4e58 --- .pre-commit-config.yaml | 13 +++++-------- api-ref/source/watcher-api-v1-goals.inc | 4 ++-- doc/dictionary.txt | 4 ++++ doc/ext/term.py | 2 +- doc/source/admin/gmr.rst | 2 +- doc/source/architecture.rst | 2 +- doc/source/contributor/concurrency.rst | 2 +- doc/source/man/general-options.rst | 2 +- .../add-scoring-module-fa00d013ed2d614e.yaml | 2 +- .../notes/api-call-retry-fef741ac684c58dd.yaml | 2 +- .../api-microversioning-7999a3ee8073bf32.yaml | 2 +- ...ision-engine-threadpool-0711b23abfc9d409.yaml | 2 +- ...rove-compute-data-model-b427c85e4ed2b6fb.yaml | 2 +- ...tcher-notifications-ovo-7b44d52ef6400dd0.yaml | 2 +- .../watcher-service-list-7b2f4b64f71e9b89.yaml | 2 +- setup.cfg | 5 +++++ watcher/api/controllers/v1/action.py | 2 +- watcher/api/controllers/v1/action_plan.py | 2 +- watcher/api/controllers/v1/audit.py | 2 +- watcher/api/controllers/v1/audit_template.py | 2 +- watcher/api/controllers/v1/goal.py | 4 ++-- watcher/api/controllers/v1/service.py | 2 +- watcher/api/controllers/v1/strategy.py | 2 +- watcher/common/keystone_helper.py | 4 ++-- watcher/conf/applier.py | 2 +- .../strategy/selection/default.py | 4 ++-- .../strategy/strategies/host_maintenance.py | 2 +- .../strategy/strategies/zone_migration.py | 6 +++--- watcher/decision_engine/threading.py | 4 ++-- watcher/tests/api/v1/test_actions.py | 2 +- watcher/tests/api/v1/test_actions_plans.py | 2 +- watcher/tests/api/v1/test_audit_templates.py | 2 +- watcher/tests/api/v1/test_audits.py | 2 +- watcher/tests/api/v1/test_data_model.py | 2 +- watcher/tests/api/v1/test_strategies.py | 2 +- watcher/tests/common/metal_helper/test_maas.py | 2 +- .../model/faker_cluster_and_metrics.py | 4 ++-- watcher/tests/decision_engine/test_sync.py | 14 +++++++------- watcher/tests/objects/test_objects.py | 16 ++++++++-------- 39 files changed, 71 insertions(+), 65 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 70ea5f8b8..99e971703 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -41,14 +41,11 @@ repos: hooks: - id: autopep8 files: '^.*\.py$' - # FIXME(sean-k-mooney): we have many typos and some false - # positives that need to be added to the dictionary - # correct this in a followup change - # - repo: https://github.com/codespell-project/codespell - # rev: v2.3.0 - # hooks: - # - id: codespell - # args: ['--ignore-words=doc/dictionary.txt'] + - repo: https://github.com/codespell-project/codespell + rev: v2.3.0 + hooks: + - id: codespell + args: ['--ignore-words=doc/dictionary.txt'] # FIXME(sean-k-mooney): we have many sphinx issues fix them # in a separate commit to make it easier to review # - repo: https://github.com/sphinx-contrib/sphinx-lint diff --git a/api-ref/source/watcher-api-v1-goals.inc b/api-ref/source/watcher-api-v1-goals.inc index 2d48c0778..11aa5d8cb 100644 --- a/api-ref/source/watcher-api-v1-goals.inc +++ b/api-ref/source/watcher-api-v1-goals.inc @@ -12,7 +12,7 @@ Here are some examples of ``Goals``: - minimize the energy consumption - minimize the number of compute nodes (consolidation) - balance the workload among compute nodes -- minimize the license cost (some softwares have a licensing model which is +- minimize the license cost (some software have a licensing model which is based on the number of sockets or cores where the software is deployed) - find the most appropriate moment for a planned maintenance on a given group of host (which may be an entire availability zone): @@ -123,4 +123,4 @@ Response **Example JSON representation of a Goal:** .. literalinclude:: samples/goal-show-response.json - :language: javascript \ No newline at end of file + :language: javascript diff --git a/doc/dictionary.txt b/doc/dictionary.txt index e69de29bb..58cf09eaa 100644 --- a/doc/dictionary.txt +++ b/doc/dictionary.txt @@ -0,0 +1,4 @@ +thirdparty +assertin +notin + diff --git a/doc/ext/term.py b/doc/ext/term.py index 67cba1af0..f50f634b9 100644 --- a/doc/ext/term.py +++ b/doc/ext/term.py @@ -52,7 +52,7 @@ class BaseWatcherDirective(rst.Directive): obj_raw_docstring = obj.__init__.__doc__ if not obj_raw_docstring: - # Raise a warning to make the tests fail wit doc8 + # Raise a warning to make the tests fail with doc8 raise self.error("No docstring available for %s!" % obj) obj_docstring = inspect.cleandoc(obj_raw_docstring) diff --git a/doc/source/admin/gmr.rst b/doc/source/admin/gmr.rst index 31ea4f582..75ffad7e1 100644 --- a/doc/source/admin/gmr.rst +++ b/doc/source/admin/gmr.rst @@ -34,7 +34,7 @@ own sections. However, the base *GMR* consists of several sections: Package Shows information about the package to which this process belongs, including - version informations. + version information. Threads Shows stack traces and thread ids for each of the threads within this diff --git a/doc/source/architecture.rst b/doc/source/architecture.rst index 36806dd1b..350da68aa 100644 --- a/doc/source/architecture.rst +++ b/doc/source/architecture.rst @@ -285,7 +285,7 @@ Audit and interval (in case of CONTINUOUS type). There is three types of Audit: ONESHOT, CONTINUOUS and EVENT. ONESHOT Audit is launched once and if it succeeded executed new action plan list will be provided; CONTINUOUS Audit creates action plans with specified interval (in seconds or cron format, cron -inteval can be used like: `*/5 * * * *`), if action plan +interval can be used like: `*/5 * * * *`), if action plan has been created, all previous action plans get CANCELLED state; EVENT audit is launched when receiving webhooks API. diff --git a/doc/source/contributor/concurrency.rst b/doc/source/contributor/concurrency.rst index 11815cc25..7db51cac2 100644 --- a/doc/source/contributor/concurrency.rst +++ b/doc/source/contributor/concurrency.rst @@ -221,7 +221,7 @@ workflow engine can halt or take other actions while the action plan is being executed based on the success or failure of individual actions. However, the base workflow engine simply uses these notifies to store the result of individual actions in the database. Additionally, since taskflow uses a graph -flow if any of the tasks would fail all childs of this tasks not be executed +flow if any of the tasks would fail all children of this tasks not be executed while ``do_revert`` will be triggered for all parents. .. code-block:: python diff --git a/doc/source/man/general-options.rst b/doc/source/man/general-options.rst index 71aa842e4..bc5976e3d 100644 --- a/doc/source/man/general-options.rst +++ b/doc/source/man/general-options.rst @@ -48,7 +48,7 @@ logging configuration to any other existing logging options. Please see the Python logging module documentation for details on logging configuration files. The log-config - name for this option is depcrecated. + name for this option is deprecated. **--log-format FORMAT** A logging.Formatter log message format string which may use any diff --git a/releasenotes/notes/add-scoring-module-fa00d013ed2d614e.yaml b/releasenotes/notes/add-scoring-module-fa00d013ed2d614e.yaml index 1255b7131..4edd7d5f2 100644 --- a/releasenotes/notes/add-scoring-module-fa00d013ed2d614e.yaml +++ b/releasenotes/notes/add-scoring-module-fa00d013ed2d614e.yaml @@ -4,4 +4,4 @@ features: will standardize interactions with scoring engines through the common API. It is possible to use the scoring engine by different Strategies, which - improve the code and data model re-use. + improve the code and data model reuse. diff --git a/releasenotes/notes/api-call-retry-fef741ac684c58dd.yaml b/releasenotes/notes/api-call-retry-fef741ac684c58dd.yaml index 7d5d4d774..96ab304d9 100644 --- a/releasenotes/notes/api-call-retry-fef741ac684c58dd.yaml +++ b/releasenotes/notes/api-call-retry-fef741ac684c58dd.yaml @@ -5,5 +5,5 @@ features: failure. The amount of failures allowed before giving up and the time before reattempting are configurable. The `api_call_retries` and `api_query_timeout` parameters in the `[collector]` group can be used to - adjust these paremeters. 10 retries with a 1 second time in between + adjust these parameters. 10 retries with a 1 second time in between reattempts is the default. diff --git a/releasenotes/notes/api-microversioning-7999a3ee8073bf32.yaml b/releasenotes/notes/api-microversioning-7999a3ee8073bf32.yaml index 691c6731d..600ae8794 100644 --- a/releasenotes/notes/api-microversioning-7999a3ee8073bf32.yaml +++ b/releasenotes/notes/api-microversioning-7999a3ee8073bf32.yaml @@ -3,6 +3,6 @@ features: Watcher starts to support API microversions since Stein cycle. From now onwards all API changes should be made with saving backward compatibility. To specify API version operator should use OpenStack-API-Version - HTTP header. If operator wants to know the mininum and maximum supported + HTTP header. If operator wants to know the minimum and maximum supported versions by API, he/she can access /v1 resource and Watcher API will return appropriate headers in response. diff --git a/releasenotes/notes/general-purpose-decision-engine-threadpool-0711b23abfc9d409.yaml b/releasenotes/notes/general-purpose-decision-engine-threadpool-0711b23abfc9d409.yaml index 269edc7f9..6c8c1dff9 100644 --- a/releasenotes/notes/general-purpose-decision-engine-threadpool-0711b23abfc9d409.yaml +++ b/releasenotes/notes/general-purpose-decision-engine-threadpool-0711b23abfc9d409.yaml @@ -7,7 +7,7 @@ prelude: > features: - | A new threadpool for the decision engine that contributors can use to - improve the performance of many operations, primarily I/O bound onces. + improve the performance of many operations, primarily I/O bound ones. The amount of workers used by the decision engine threadpool can be configured to scale according to the available infrastructure using the `watcher_decision_engine.max_general_workers` config option. diff --git a/releasenotes/notes/improve-compute-data-model-b427c85e4ed2b6fb.yaml b/releasenotes/notes/improve-compute-data-model-b427c85e4ed2b6fb.yaml index 5b015411f..3ce8e8f7a 100644 --- a/releasenotes/notes/improve-compute-data-model-b427c85e4ed2b6fb.yaml +++ b/releasenotes/notes/improve-compute-data-model-b427c85e4ed2b6fb.yaml @@ -13,7 +13,7 @@ features: * disk_gb_reserved: The amount of disk a node has reserved for its own use. * disk_ratio: Disk allocation ratio. - We also add some new propeties: + We also add some new properties: * vcpu_capacity: The amount of vcpu, take allocation ratio into account, but do not include reserved. diff --git a/releasenotes/notes/watcher-notifications-ovo-7b44d52ef6400dd0.yaml b/releasenotes/notes/watcher-notifications-ovo-7b44d52ef6400dd0.yaml index d469c00ac..fd8e8be9d 100644 --- a/releasenotes/notes/watcher-notifications-ovo-7b44d52ef6400dd0.yaml +++ b/releasenotes/notes/watcher-notifications-ovo-7b44d52ef6400dd0.yaml @@ -4,5 +4,5 @@ features: Whenever a Watcher object is created, updated or deleted, a versioned notification will, if it's relevant, be automatically sent to notify in order to allow an event-driven style of architecture within Watcher. Moreover, it - will also give other services and/or 3rd party softwares (e.g. monitoring + will also give other services and/or 3rd party software (e.g. monitoring solutions or rules engines) the ability to react to such events. diff --git a/releasenotes/notes/watcher-service-list-7b2f4b64f71e9b89.yaml b/releasenotes/notes/watcher-service-list-7b2f4b64f71e9b89.yaml index 9710b9710..8afbac4ae 100644 --- a/releasenotes/notes/watcher-service-list-7b2f4b64f71e9b89.yaml +++ b/releasenotes/notes/watcher-service-list-7b2f4b64f71e9b89.yaml @@ -1,3 +1,3 @@ --- features: - - Add a service supervisor to watch Watcher deamons. + - Add a service supervisor to watch Watcher daemons. diff --git a/setup.cfg b/setup.cfg index af5bf943c..41220fce0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -109,3 +109,8 @@ watcher_cluster_data_model_collectors = compute = watcher.decision_engine.model.collector.nova:NovaClusterDataModelCollector storage = watcher.decision_engine.model.collector.cinder:CinderClusterDataModelCollector baremetal = watcher.decision_engine.model.collector.ironic:BaremetalClusterDataModelCollector + +[codespell] +skip = *.po,*.js,*.css,*.html,*.svg,HACKING.py,*hacking*,*build*,*_static*,doc/dictionary.txt,*.pyc,*.inv,*.gz,*.jpg,*.png,*.vsd,*.graffle,*.json +count = +quiet-level = 4 \ No newline at end of file diff --git a/watcher/api/controllers/v1/action.py b/watcher/api/controllers/v1/action.py index 3746ed8f6..e8ea8e72c 100644 --- a/watcher/api/controllers/v1/action.py +++ b/watcher/api/controllers/v1/action.py @@ -334,7 +334,7 @@ class ActionsController(rest.RestController): policy.enforce(context, 'action:detail', action='action:detail') - # NOTE(lucasagomes): /detail should only work agaist collections + # NOTE(lucasagomes): /detail should only work against collections parent = pecan.request.path.split('/')[:-1][-1] if parent != "actions": raise exception.HTTPNotFound diff --git a/watcher/api/controllers/v1/action_plan.py b/watcher/api/controllers/v1/action_plan.py index 01f3a674c..a0e7db92e 100644 --- a/watcher/api/controllers/v1/action_plan.py +++ b/watcher/api/controllers/v1/action_plan.py @@ -433,7 +433,7 @@ class ActionPlansController(rest.RestController): policy.enforce(context, 'action_plan:detail', action='action_plan:detail') - # NOTE(lucasagomes): /detail should only work agaist collections + # NOTE(lucasagomes): /detail should only work against collections parent = pecan.request.path.split('/')[:-1][-1] if parent != "action_plans": raise exception.HTTPNotFound diff --git a/watcher/api/controllers/v1/audit.py b/watcher/api/controllers/v1/audit.py index ccd850e1d..70c825e27 100644 --- a/watcher/api/controllers/v1/audit.py +++ b/watcher/api/controllers/v1/audit.py @@ -570,7 +570,7 @@ class AuditsController(rest.RestController): context = pecan.request.context policy.enforce(context, 'audit:detail', action='audit:detail') - # NOTE(lucasagomes): /detail should only work agaist collections + # NOTE(lucasagomes): /detail should only work against collections parent = pecan.request.path.split('/')[:-1][-1] if parent != "audits": raise exception.HTTPNotFound diff --git a/watcher/api/controllers/v1/audit_template.py b/watcher/api/controllers/v1/audit_template.py index 160b3ad51..1d6de34c7 100644 --- a/watcher/api/controllers/v1/audit_template.py +++ b/watcher/api/controllers/v1/audit_template.py @@ -576,7 +576,7 @@ class AuditTemplatesController(rest.RestController): policy.enforce(context, 'audit_template:detail', action='audit_template:detail') - # NOTE(lucasagomes): /detail should only work agaist collections + # NOTE(lucasagomes): /detail should only work against collections parent = pecan.request.path.split('/')[:-1][-1] if parent != "audit_templates": raise exception.HTTPNotFound diff --git a/watcher/api/controllers/v1/goal.py b/watcher/api/controllers/v1/goal.py index 0f32f29a1..11371eeee 100644 --- a/watcher/api/controllers/v1/goal.py +++ b/watcher/api/controllers/v1/goal.py @@ -24,7 +24,7 @@ Here are some examples of :ref:`Goals `: - minimize the energy consumption - minimize the number of compute nodes (consolidation) - balance the workload among compute nodes -- minimize the license cost (some softwares have a licensing model which is +- minimize the license cost (some software have a licensing model which is based on the number of sockets or cores where the software is deployed) - find the most appropriate moment for a planned maintenance on a given group of host (which may be an entire availability zone): @@ -217,7 +217,7 @@ class GoalsController(rest.RestController): context = pecan.request.context policy.enforce(context, 'goal:detail', action='goal:detail') - # NOTE(lucasagomes): /detail should only work agaist collections + # NOTE(lucasagomes): /detail should only work against collections parent = pecan.request.path.split('/')[:-1][-1] if parent != "goals": raise exception.HTTPNotFound diff --git a/watcher/api/controllers/v1/service.py b/watcher/api/controllers/v1/service.py index 5552aae5f..1ea7ae91f 100644 --- a/watcher/api/controllers/v1/service.py +++ b/watcher/api/controllers/v1/service.py @@ -237,7 +237,7 @@ class ServicesController(rest.RestController): context = pecan.request.context policy.enforce(context, 'service:detail', action='service:detail') - # NOTE(lucasagomes): /detail should only work agaist collections + # NOTE(lucasagomes): /detail should only work against collections parent = pecan.request.path.split('/')[:-1][-1] if parent != "services": raise exception.HTTPNotFound diff --git a/watcher/api/controllers/v1/strategy.py b/watcher/api/controllers/v1/strategy.py index 91894936a..063c16377 100644 --- a/watcher/api/controllers/v1/strategy.py +++ b/watcher/api/controllers/v1/strategy.py @@ -284,7 +284,7 @@ class StrategiesController(rest.RestController): context = pecan.request.context policy.enforce(context, 'strategy:detail', action='strategy:detail') - # NOTE(lucasagomes): /detail should only work agaist collections + # NOTE(lucasagomes): /detail should only work against collections parent = pecan.request.path.split('/')[:-1][-1] if parent != "strategies": raise exception.HTTPNotFound diff --git a/watcher/common/keystone_helper.py b/watcher/common/keystone_helper.py index f16e39800..53ff8e2bd 100644 --- a/watcher/common/keystone_helper.py +++ b/watcher/common/keystone_helper.py @@ -72,8 +72,8 @@ class KeystoneHelper(object): message=(_("Project not Found: %s") % name_or_id)) if len(projects) > 1: raise exception.Invalid( - messsage=(_("Project name seems ambiguous: %s") % - name_or_id)) + message=(_("Project name seems ambiguous: %s") % + name_or_id)) return projects[0] def get_domain(self, name_or_id): diff --git a/watcher/conf/applier.py b/watcher/conf/applier.py index 34ee80d96..3d0c58733 100644 --- a/watcher/conf/applier.py +++ b/watcher/conf/applier.py @@ -47,7 +47,7 @@ APPLIER_OPTS = [ cfg.BoolOpt('rollback_when_actionplan_failed', default=False, help='If set True, the failed actionplan will rollback ' - 'when executing. Defaule value is False.'), + 'when executing. Default value is False.'), ] diff --git a/watcher/decision_engine/strategy/selection/default.py b/watcher/decision_engine/strategy/selection/default.py index ac73447d7..ea8b91049 100644 --- a/watcher/decision_engine/strategy/selection/default.py +++ b/watcher/decision_engine/strategy/selection/default.py @@ -52,8 +52,8 @@ class DefaultStrategySelector(base.BaseSelector): else: available_strategies = self.strategy_loader.list_available() available_strategies_for_goal = list( - key for key, strat in available_strategies.items() - if strat.get_goal_name() == self.goal_name) + key for key, strategy in available_strategies.items() + if strategy.get_goal_name() == self.goal_name) if not available_strategies_for_goal: raise exception.NoAvailableStrategyForGoal( diff --git a/watcher/decision_engine/strategy/strategies/host_maintenance.py b/watcher/decision_engine/strategy/strategies/host_maintenance.py index a23ea07c8..db9b1e217 100644 --- a/watcher/decision_engine/strategy/strategies/host_maintenance.py +++ b/watcher/decision_engine/strategy/strategies/host_maintenance.py @@ -32,7 +32,7 @@ class HostMaintenance(base.HostMaintenanceBaseStrategy): *Description* It is a migration strategy for one compute node maintenance, - without having the user's application been interruptted. + without having the user's application been interrupted. If given one backup node, the strategy will firstly migrate all instances from the maintenance node to the backup node. If the backup node is not provided, diff --git a/watcher/decision_engine/strategy/strategies/zone_migration.py b/watcher/decision_engine/strategy/strategies/zone_migration.py index 227a8a93c..16dd2f0d9 100644 --- a/watcher/decision_engine/strategy/strategies/zone_migration.py +++ b/watcher/decision_engine/strategy/strategies/zone_migration.py @@ -563,7 +563,7 @@ class ZoneMigration(base.ZoneMigrationBaseStrategy): filter_actions = self.get_priority_filter_list() LOG.debug(filter_actions) - # apply all filters set in input prameter + # apply all filters set in input parameter for action in list(reversed(filter_actions)): LOG.debug(action) result = action.apply_filter(result) @@ -795,7 +795,7 @@ class ComputeHostSortFilter(SortMovingToFrontFilter): :param item: instance object :param sort_key: compute host name - :returns: true: compute name on which intance is equals sort_key + :returns: true: compute name on where instance host equals sort_key false: otherwise """ @@ -823,7 +823,7 @@ class StorageHostSortFilter(SortMovingToFrontFilter): :param item: volume object :param sort_key: storage pool name - :returns: true: pool name on which intance is equals sort_key + :returns: true: pool name on where instance.host equals sort_key false: otherwise """ diff --git a/watcher/decision_engine/threading.py b/watcher/decision_engine/threading.py index 68d1baf38..8b9453a97 100644 --- a/watcher/decision_engine/threading.py +++ b/watcher/decision_engine/threading.py @@ -59,7 +59,7 @@ class DecisionEngineThreadPool(object, metaclass=service.Singleton): :param futures: list, set or dictionary of futures :type futures: list :py:class:`futurist.GreenFuture` - :param fn: function to execute upon the future finishing exection + :param fn: function to execute upon the future finishing execution :param args: arguments for the function :param kwargs: amount of arguments for the function """ @@ -83,7 +83,7 @@ class DecisionEngineThreadPool(object, metaclass=service.Singleton): :param futures: list, set or dictionary of futures :type futures: list :py:class:`futurist.GreenFuture` - :param fn: function to execute upon the future finishing exection + :param fn: function to execute upon the future finishing execution :param args: arguments for the function :param kwargs: amount of arguments for the function """ diff --git a/watcher/tests/api/v1/test_actions.py b/watcher/tests/api/v1/test_actions.py index 9dde45833..bd9981823 100644 --- a/watcher/tests/api/v1/test_actions.py +++ b/watcher/tests/api/v1/test_actions.py @@ -536,7 +536,7 @@ class TestActionPolicyEnforcement(api_base.FunctionalTest): self.policy.set_rules({ "admin_api": "(role:admin or role:administrator)", "default": "rule:admin_api", - rule: "rule:defaut"}) + rule: "rule:default"}) response = func(*arg, **kwarg) self.assertEqual(HTTPStatus.FORBIDDEN, response.status_int) self.assertEqual('application/json', response.content_type) diff --git a/watcher/tests/api/v1/test_actions_plans.py b/watcher/tests/api/v1/test_actions_plans.py index 8f7ec60c6..7058b3724 100644 --- a/watcher/tests/api/v1/test_actions_plans.py +++ b/watcher/tests/api/v1/test_actions_plans.py @@ -635,7 +635,7 @@ class TestActionPlanPolicyEnforcement(api_base.FunctionalTest): self.policy.set_rules({ "admin_api": "(role:admin or role:administrator)", "default": "rule:admin_api", - rule: "rule:defaut"}) + rule: "rule:default"}) response = func(*arg, **kwarg) self.assertEqual(HTTPStatus.FORBIDDEN, response.status_int) self.assertEqual('application/json', response.content_type) diff --git a/watcher/tests/api/v1/test_audit_templates.py b/watcher/tests/api/v1/test_audit_templates.py index 0117a8270..7b138e664 100644 --- a/watcher/tests/api/v1/test_audit_templates.py +++ b/watcher/tests/api/v1/test_audit_templates.py @@ -785,7 +785,7 @@ class TestAuditTemplatePolicyEnforcement(api_base.FunctionalTest): self.policy.set_rules({ "admin_api": "(role:admin or role:administrator)", "default": "rule:admin_api", - rule: "rule:defaut"}) + rule: "rule:default"}) response = func(*arg, **kwarg) self.assertEqual(HTTPStatus.FORBIDDEN, response.status_int) self.assertEqual('application/json', response.content_type) diff --git a/watcher/tests/api/v1/test_audits.py b/watcher/tests/api/v1/test_audits.py index 1e98e5836..505923593 100644 --- a/watcher/tests/api/v1/test_audits.py +++ b/watcher/tests/api/v1/test_audits.py @@ -1058,7 +1058,7 @@ class TestAuditPolicyEnforcement(api_base.FunctionalTest): self.policy.set_rules({ "admin_api": "(role:admin or role:administrator)", "default": "rule:admin_api", - rule: "rule:defaut"}) + rule: "rule:default"}) response = func(*arg, **kwarg) self.assertEqual(HTTPStatus.FORBIDDEN, response.status_int) self.assertEqual('application/json', response.content_type) diff --git a/watcher/tests/api/v1/test_data_model.py b/watcher/tests/api/v1/test_data_model.py index 640bf2ddd..0fff21265 100644 --- a/watcher/tests/api/v1/test_data_model.py +++ b/watcher/tests/api/v1/test_data_model.py @@ -58,7 +58,7 @@ class TestDataModelPolicyEnforcement(api_base.FunctionalTest): self.policy.set_rules({ "admin_api": "(role:admin or role:administrator)", "default": "rule:admin_api", - rule: "rule:defaut"}) + rule: "rule:default"}) response = func(*arg, **kwarg) self.assertEqual(HTTPStatus.FORBIDDEN, response.status_int) self.assertEqual('application/json', response.content_type) diff --git a/watcher/tests/api/v1/test_strategies.py b/watcher/tests/api/v1/test_strategies.py index a4b82a4a0..4600ea3b6 100644 --- a/watcher/tests/api/v1/test_strategies.py +++ b/watcher/tests/api/v1/test_strategies.py @@ -255,7 +255,7 @@ class TestStrategyPolicyEnforcement(api_base.FunctionalTest): self.policy.set_rules({ "admin_api": "(role:admin or role:administrator)", "default": "rule:admin_api", - rule: "rule:defaut"}) + rule: "rule:default"}) response = func(*arg, **kwarg) self.assertEqual(HTTPStatus.FORBIDDEN, response.status_int) self.assertEqual('application/json', response.content_type) diff --git a/watcher/tests/common/metal_helper/test_maas.py b/watcher/tests/common/metal_helper/test_maas.py index 4afa49a72..26ccd8236 100644 --- a/watcher/tests/common/metal_helper/test_maas.py +++ b/watcher/tests/common/metal_helper/test_maas.py @@ -38,7 +38,7 @@ class TestMaasNode(base.TestCase): def test_get_power_state(self): if not maas_enum: - self.skipTest("python-libmaas not intalled.") + self.skipTest("python-libmaas not installed.") self._wrapped_node.query_power_state.side_effect = ( maas_enum.PowerState.ON, diff --git a/watcher/tests/decision_engine/model/faker_cluster_and_metrics.py b/watcher/tests/decision_engine/model/faker_cluster_and_metrics.py index 5beb285e5..8120c2695 100644 --- a/watcher/tests/decision_engine/model/faker_cluster_and_metrics.py +++ b/watcher/tests/decision_engine/model/faker_cluster_and_metrics.py @@ -105,10 +105,10 @@ class FakeGnocchiMetrics(object): def get_compute_node_cpu_util(self, resource, period, aggregate, granularity): - """Calculates node utilization dynamicaly. + """Calculates node utilization dynamically. node CPU utilization should consider - and corelate with actual instance-node mappings + and correlate with actual instance-node mappings provided within a cluster model. Returns relative node CPU utilization <0, 100>. :param r_id: resource id diff --git a/watcher/tests/decision_engine/test_sync.py b/watcher/tests/decision_engine/test_sync.py index df397919e..14da958f4 100644 --- a/watcher/tests/decision_engine/test_sync.py +++ b/watcher/tests/decision_engine/test_sync.py @@ -76,22 +76,22 @@ class TestSyncer(base.DbTestCase): self.addCleanup(p_strategies.stop) @staticmethod - def _find_created_modified_unmodified_ids(befores, afters): + def _find_created_modified_unmodified_ids(before, after): created = { - a_item.id: a_item for a_item in afters - if a_item.uuid not in (b_item.uuid for b_item in befores) + a_item.id: a_item for a_item in after + if a_item.uuid not in (b_item.uuid for b_item in before) } modified = { - a_item.id: a_item for a_item in afters + a_item.id: a_item for a_item in after if a_item.as_dict() not in ( - b_items.as_dict() for b_items in befores) + b_items.as_dict() for b_items in before) } unmodified = { - a_item.id: a_item for a_item in afters + a_item.id: a_item for a_item in after if a_item.as_dict() in ( - b_items.as_dict() for b_items in befores) + b_items.as_dict() for b_items in before) } return created, modified, unmodified diff --git a/watcher/tests/objects/test_objects.py b/watcher/tests/objects/test_objects.py index 8c40dde30..74497677a 100644 --- a/watcher/tests/objects/test_objects.py +++ b/watcher/tests/objects/test_objects.py @@ -459,24 +459,24 @@ class TestObjectVersions(test_base.TestCase): class TestObjectSerializer(test_base.TestCase): def test_object_serialization(self): - ser = base.WatcherObjectSerializer() + obj_ser = base.WatcherObjectSerializer() obj = MyObj(self.context) - primitive = ser.serialize_entity(self.context, obj) + primitive = obj_ser.serialize_entity(self.context, obj) self.assertIn('watcher_object.name', primitive) - obj2 = ser.deserialize_entity(self.context, primitive) + obj2 = obj_ser.deserialize_entity(self.context, primitive) self.assertIsInstance(obj2, MyObj) self.assertEqual(self.context, obj2._context) def test_object_serialization_iterables(self): - ser = base.WatcherObjectSerializer() + obj_ser = base.WatcherObjectSerializer() obj = MyObj(self.context) for iterable in (list, tuple, set): thing = iterable([obj]) - primitive = ser.serialize_entity(self.context, thing) + primitive = obj_ser.serialize_entity(self.context, thing) self.assertEqual(1, len(primitive)) for item in primitive: self.assertFalse(isinstance(item, base.WatcherObject)) - thing2 = ser.deserialize_entity(self.context, primitive) + thing2 = obj_ser.deserialize_entity(self.context, primitive) self.assertEqual(1, len(thing2)) for item in thing2: self.assertIsInstance(item, MyObj) @@ -485,7 +485,7 @@ class TestObjectSerializer(test_base.TestCase): def _test_deserialize_entity_newer(self, obj_version, backported_to, mock_indirection_api, my_version='1.6'): - ser = base.WatcherObjectSerializer() + obj_ser = base.WatcherObjectSerializer() mock_indirection_api.object_backport_versions.return_value \ = 'backported' @@ -496,7 +496,7 @@ class TestObjectSerializer(test_base.TestCase): obj = MyTestObj(self.context) obj.VERSION = obj_version primitive = obj.obj_to_primitive() - result = ser.deserialize_entity(self.context, primitive) + result = obj_ser.deserialize_entity(self.context, primitive) if backported_to is None: self.assertFalse( mock_indirection_api.object_backport_versions.called)