Skip to content

Commit 04bc51c

Browse files
committed
run format & lint
1 parent 0ca9740 commit 04bc51c

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

poetry.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/integration/ha_tests/helpers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,7 @@ async def get_db_connection(ops_test, dbname, is_primary=True, replica_unit_name
809809
)
810810
return connection_string, unit_name
811811

812+
812813
async def validate_test_data(connection_string):
813814
with psycopg2.connect(connection_string) as connection:
814815
connection.autocommit = True
@@ -831,4 +832,4 @@ async def create_test_data(connection_string):
831832
cursor.execute("SELECT data FROM test;")
832833
data = cursor.fetchone()
833834
assert data[0] == "some data"
834-
connection.close()
835+
connection.close()

tests/integration/ha_tests/test_self_healing.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import asyncio
55
import logging
66

7-
import psycopg2
87
import pytest
98
from pip._vendor import requests
109
from pytest_operator.plugin import OpsTest
@@ -16,7 +15,8 @@
1615
get_machine_from_unit,
1716
get_password,
1817
get_unit_address,
19-
run_command_on_unit, scale_application, build_connection_string, FIRST_DATABASE_RELATION_NAME,
18+
run_command_on_unit,
19+
scale_application,
2020
)
2121
from .conftest import APPLICATION_NAME
2222
from .helpers import (
@@ -29,10 +29,12 @@
2929
change_patroni_setting,
3030
change_wal_settings,
3131
check_writes,
32+
create_test_data,
3233
cut_network_from_unit,
3334
cut_network_from_unit_without_ip_change,
3435
fetch_cluster_members,
3536
get_controller_machine,
37+
get_db_connection,
3638
get_patroni_setting,
3739
get_primary,
3840
get_unit_ip,
@@ -51,7 +53,8 @@
5153
storage_id,
5254
storage_type,
5355
update_restart_condition,
54-
wait_network_restore, get_db_connection, validate_test_data, create_test_data,
56+
validate_test_data,
57+
wait_network_restore,
5558
)
5659

5760
logger = logging.getLogger(__name__)
@@ -584,8 +587,10 @@ async def test_deploy_zero_units(ops_test: OpsTest):
584587
for unit_ip in unit_ip_addresses:
585588
try:
586589
resp = requests.get(f"http://{unit_ip}:8008")
587-
assert resp.status_code != 200, f"status code = {resp.status_code}, message = {resp.text}"
588-
except requests.exceptions.ConnectionError as e:
590+
assert (
591+
resp.status_code != 200
592+
), f"status code = {resp.status_code}, message = {resp.text}"
593+
except requests.exceptions.ConnectionError:
589594
assert True, f"unit host = http://{unit_ip}:8008, all units shutdown"
590595
except Exception as e:
591596
assert False, f"{e} unit host = http://{unit_ip}:8008, something went wrong"
@@ -608,13 +613,13 @@ async def test_deploy_zero_units(ops_test: OpsTest):
608613
await ops_test.model.wait_for_idle(status="active", timeout=3000)
609614
for unit in ops_test.model.applications[app].units:
610615
if not await unit.is_leader_from_status():
611-
assert await reused_replica_storage(ops_test, unit_name=unit.name
612-
), "attached storage not properly re-used by Postgresql."
616+
assert await reused_replica_storage(
617+
ops_test, unit_name=unit.name
618+
), "attached storage not properly re-used by Postgresql."
613619
logger.info(f"check test database data of unit name {unit.name}")
614-
connection_string, _ = await get_db_connection(ops_test,
615-
dbname=dbname,
616-
is_primary=False,
617-
replica_unit_name=unit.name)
620+
connection_string, _ = await get_db_connection(
621+
ops_test, dbname=dbname, is_primary=False, replica_unit_name=unit.name
622+
)
618623
await validate_test_data(connection_string)
619624

620-
await check_writes(ops_test)
625+
await check_writes(ops_test)

0 commit comments

Comments
 (0)