Skip to content

Commit 770779c

Browse files
committed
handle error: storage belongs to different cluster
1 parent 9a65cf1 commit 770779c

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

tests/integration/ha_tests/test_self_healing.py

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ async def test_deploy_zero_units(ops_test: OpsTest, charm):
624624
logger.info("check test database data")
625625
await validate_test_data(connection_string)
626626

627-
logger.info("scaling database to tow unit using foreign cluster")
627+
logger.info("database scaling up to two units using third-party cluster storage")
628628
new_unit = await add_unit_with_storage(ops_test, app=app, storage=second_storage, is_blocked=True)
629629

630630
logger.info(f"remove unit {new_unit.name} with storage from application {SECOND_APPLICATION}")
@@ -635,34 +635,34 @@ async def test_deploy_zero_units(ops_test: OpsTest, charm):
635635
logger.info("check test database data")
636636
await validate_test_data(connection_string)
637637

638-
# # Scale up to two units.
639-
# logger.info("scaling database to two unit")
640-
# prev_units = [unit.name for unit in ops_test.model.applications[app].units]
641-
# await scale_application(ops_test, application_name=app, count=2)
642-
# unit = await get_last_added_unit(ops_test, app, prev_units)
643-
#
644-
# logger.info(f"check test database data of unit name {unit.name}")
645-
# connection_string, _ = await get_db_connection(
646-
# ops_test, dbname=dbname, is_primary=False, replica_unit_name=unit.name
647-
# )
648-
# await validate_test_data(connection_string)
649-
# assert await reused_replica_storage(
650-
# ops_test, unit_name=unit.name
651-
# ), "attached storage not properly re-used by Postgresql."
652-
#
653-
# # Scale up to three units.
654-
# logger.info("scaling database to three unit")
655-
# prev_units = [unit.name for unit in ops_test.model.applications[app].units]
656-
# await scale_application(ops_test, application_name=app, count=3)
657-
# unit = await get_last_added_unit(ops_test, app, prev_units)
658-
#
659-
# logger.info(f"check test database data of unit name {unit.name}")
660-
# connection_string, _ = await get_db_connection(
661-
# ops_test, dbname=dbname, is_primary=False, replica_unit_name=unit.name
662-
# )
663-
# await validate_test_data(connection_string)
664-
# assert await reused_replica_storage(
665-
# ops_test, unit_name=unit.name
666-
# ), "attached storage not properly re-used by Postgresql."
667-
#
668-
# await check_writes(ops_test)
638+
# Scale up to two units.
639+
logger.info("scaling database to two unit")
640+
prev_units = [unit.name for unit in ops_test.model.applications[app].units]
641+
await scale_application(ops_test, application_name=app, count=2)
642+
unit = await get_last_added_unit(ops_test, app, prev_units)
643+
644+
logger.info(f"check test database data of unit name {unit.name}")
645+
connection_string, _ = await get_db_connection(
646+
ops_test, dbname=dbname, is_primary=False, replica_unit_name=unit.name
647+
)
648+
await validate_test_data(connection_string)
649+
assert await reused_replica_storage(
650+
ops_test, unit_name=unit.name
651+
), "attached storage not properly re-used by Postgresql."
652+
653+
# Scale up to three units.
654+
logger.info("scaling database to three unit")
655+
prev_units = [unit.name for unit in ops_test.model.applications[app].units]
656+
await scale_application(ops_test, application_name=app, count=3)
657+
unit = await get_last_added_unit(ops_test, app, prev_units)
658+
659+
logger.info(f"check test database data of unit name {unit.name}")
660+
connection_string, _ = await get_db_connection(
661+
ops_test, dbname=dbname, is_primary=False, replica_unit_name=unit.name
662+
)
663+
await validate_test_data(connection_string)
664+
assert await reused_replica_storage(
665+
ops_test, unit_name=unit.name
666+
), "attached storage not properly re-used by Postgresql."
667+
668+
await check_writes(ops_test)

0 commit comments

Comments
 (0)