Skip to content

Commit f9113e2

Browse files
committed
format
1 parent 1eb10e9 commit f9113e2

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

src/cluster.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# See LICENSE file for licensing details.
44

55
"""Helper class used to manage cluster lifecycle."""
6+
67
import glob
78
import logging
89
import os
@@ -648,7 +649,6 @@ def update_synchronous_node_count(self, units: int = None) -> None:
648649
if r.status_code != 200:
649650
raise UpdateSyncNodeCountError(f"received {r.status_code}")
650651

651-
652652
def cluster_system_id_mismatch(self, unit_name: str) -> bool:
653653
"""Check if the Patroni service is down.
654654
@@ -659,7 +659,10 @@ def cluster_system_id_mismatch(self, unit_name: str) -> bool:
659659
"""
660660
last_log_file = self._last_patroni_log_file()
661661
unit_name = unit_name.replace("/", "-")
662-
if f" CRITICAL: system ID mismatch, node {unit_name} belongs to a different cluster:" in last_log_file:
662+
if (
663+
f" CRITICAL: system ID mismatch, node {unit_name} belongs to a different cluster:"
664+
in last_log_file
665+
):
663666
return True
664667
return False
665668

tests/integration/ha_tests/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ def storage_id(ops_test, unit_name):
807807
return line.split()[1]
808808

809809

810-
async def add_unit_with_storage(ops_test, app, storage, is_blocked: bool= False):
810+
async def add_unit_with_storage(ops_test, app, storage, is_blocked: bool = False):
811811
"""Adds unit with storage.
812812
813813
Note: this function exists as a temporary solution until this issue is resolved:

tests/integration/ha_tests/test_restore_cluster.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ async def test_build_and_deploy(ops_test: OpsTest) -> None:
5353
num_units=1,
5454
series=CHARM_SERIES,
5555
config={"profile": "testing"},
56-
)
56+
),
5757
)
5858
await ops_test.model.wait_for_idle(status="active", timeout=1500)
5959

tests/integration/ha_tests/test_self_healing.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from pytest_operator.plugin import OpsTest
1010
from tenacity import Retrying, stop_after_delay, wait_fixed
1111

12-
from .test_restore_cluster import SECOND_APPLICATION
1312
from ..helpers import (
1413
CHARM_SERIES,
1514
db_connect,
@@ -58,6 +57,7 @@
5857
validate_test_data,
5958
wait_network_restore,
6059
)
60+
from .test_restore_cluster import SECOND_APPLICATION
6161

6262
logger = logging.getLogger(__name__)
6363

@@ -615,7 +615,9 @@ async def test_deploy_zero_units(ops_test: OpsTest, charm):
615615
# Scale up to one unit.
616616
logger.info("scaling database to one unit")
617617
await add_unit_with_storage(ops_test, app=app, storage=primary_storage)
618-
await ops_test.model.wait_for_idle(apps=[APP_NAME, APPLICATION_NAME], status="active", timeout=1500)
618+
await ops_test.model.wait_for_idle(
619+
apps=[APP_NAME, APPLICATION_NAME], status="active", timeout=1500
620+
)
619621

620622
connection_string, _ = await get_db_connection(ops_test, dbname=dbname)
621623
logger.info("checking whether writes are increasing")
@@ -625,7 +627,9 @@ async def test_deploy_zero_units(ops_test: OpsTest, charm):
625627
await validate_test_data(connection_string)
626628

627629
logger.info("database scaling up to two units using third-party cluster storage")
628-
new_unit = await add_unit_with_storage(ops_test, app=app, storage=second_storage, is_blocked=True)
630+
new_unit = await add_unit_with_storage(
631+
ops_test, app=app, storage=second_storage, is_blocked=True
632+
)
629633

630634
logger.info(f"remove unit {new_unit.name} with storage from application {SECOND_APPLICATION}")
631635
await ops_test.model.destroy_units(new_unit.name)

0 commit comments

Comments
 (0)