From 92c2d88b853ff0f6e7abac04e64bc24b28b37293 Mon Sep 17 00:00:00 2001 From: Gabriel Cocenza Date: Tue, 6 Feb 2024 10:47:59 -0300 Subject: [PATCH] fix enable_action_managed naming --- cou/apps/base.py | 9 +++------ tests/unit/apps/test_base.py | 6 +++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/cou/apps/base.py b/cou/apps/base.py index 88796703..65d4143c 100644 --- a/cou/apps/base.py +++ b/cou/apps/base.py @@ -624,14 +624,12 @@ def _get_disable_action_managed_plan(self, parallel: bool = False) -> UpgradeSte ) return UpgradeStep() - def _get_enable_action_managed_plan(self, parallel: bool = False) -> UpgradeStep: - """Get plan to enable action-managed-upgrade. + def _get_enable_action_managed_step(self) -> UpgradeStep: + """Get step to enable action-managed-upgrade. This is used to upgrade as "paused-single-unit" strategy. - :param parallel: Parallel running, defaults to False - :type parallel: bool, optional - :return: Plan to enable action-managed-upgrade + :return: Step to enable action-managed-upgrade :rtype: UpgradeStep """ if self.config.get("action-managed-upgrade", {}).get("value", False): @@ -640,7 +638,6 @@ def _get_enable_action_managed_plan(self, parallel: bool = False) -> UpgradeStep description=( f"Change charm config of '{self.name}' 'action-managed-upgrade' to True." ), - parallel=parallel, coro=self.model.set_application_config(self.name, {"action-managed-upgrade": True}), ) diff --git a/tests/unit/apps/test_base.py b/tests/unit/apps/test_base.py index e68bcc8f..736d3889 100644 --- a/tests/unit/apps/test_base.py +++ b/tests/unit/apps/test_base.py @@ -49,7 +49,7 @@ def test_application_get_latest_os_version_failed( "charm_config", [{"action-managed-upgrade": {"value": False}}, {"action-managed-upgrade": {"value": True}}], ) -def test_get_enable_action_managed_plan(charm_config, model): +def test_get_enable_action_managed_step(charm_config, model): charm = "app" app_name = "my_app" status = MagicMock(spec_set=ApplicationStatus()) @@ -65,7 +65,7 @@ def test_get_enable_action_managed_plan(charm_config, model): app = OpenStackApplication(app_name, status, charm_config, model, charm, {}) - assert app._get_enable_action_managed_plan() == expected_upgrade_step + assert app._get_enable_action_managed_step() == expected_upgrade_step def test_get_pause_unit_step(model): @@ -85,7 +85,7 @@ def test_get_pause_unit_step(model): assert app._get_pause_unit_step(unit) == expected_upgrade_step -def test__get_resume_unit_step(model): +def test_get_resume_unit_step(model): charm = "app" app_name = "my_app" status = MagicMock(spec_set=ApplicationStatus())