From 8b0d5ef888d096c26fcdb1211a9f7c184736a3ac Mon Sep 17 00:00:00 2001 From: Dmitry Ratushnyy Date: Mon, 4 Sep 2023 08:03:05 +0000 Subject: [PATCH] Resolve review comments --- src/charm.py | 1 + tests/integration/helpers.py | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/charm.py b/src/charm.py index 70d5c1d6a..e0c31a2db 100755 --- a/src/charm.py +++ b/src/charm.py @@ -1171,6 +1171,7 @@ def _juju_secrets_get(self, scope: Scopes) -> Optional[bool]: return False def _juju_secret_get(self, scope: Scopes, key: str) -> Optional[str]: + """Helper function to get Juju secret.""" if not key: return diff --git a/tests/integration/helpers.py b/tests/integration/helpers.py index 6f3b90d2a..755f6e464 100644 --- a/tests/integration/helpers.py +++ b/tests/integration/helpers.py @@ -81,14 +81,10 @@ async def find_unit(ops_test: OpsTest, leader: bool, app=APP_NAME) -> ops.model. async def get_leader_id(ops_test: OpsTest) -> int: """Returns the unit number of the juju leader unit.""" - leader_unit_id = 0 for unit in ops_test.model.applications[APP_NAME].units: if await unit.is_leader_from_status(): - return leader_unit_id - - leader_unit_id += 1 - - return leader_unit_id + return int(unit.name.split("/")[1]) + return -1 async def set_password(