@@ -157,7 +157,7 @@ async def test_kill_db_process(
157
157
await send_signal_to_process (ops_test , primary_name , process , "SIGKILL" )
158
158
159
159
async with ops_test .fast_forward ():
160
- await are_writes_increasing (ops_test , primary_name )
160
+ await are_writes_increasing (ops_test , down_unit = primary_name )
161
161
162
162
# Verify that the database service got restarted and is ready in the old primary.
163
163
assert await is_postgresql_ready (ops_test , primary_name )
@@ -190,7 +190,7 @@ async def test_freeze_db_process(
190
190
# considered to trigger a fail-over after primary_start_timeout is changed, and also
191
191
# when freezing the DB process it take some more time to trigger the fail-over).
192
192
try :
193
- await are_writes_increasing (ops_test , primary_name )
193
+ await are_writes_increasing (ops_test , down_unit = primary_name )
194
194
195
195
# Verify that a new primary gets elected (ie old primary is secondary).
196
196
for attempt in Retrying (stop = stop_after_delay (60 * 3 ), wait = wait_fixed (3 )):
@@ -223,7 +223,7 @@ async def test_restart_db_process(
223
223
await send_signal_to_process (ops_test , primary_name , process , "SIGTERM" )
224
224
225
225
async with ops_test .fast_forward ():
226
- await are_writes_increasing (ops_test , primary_name )
226
+ await are_writes_increasing (ops_test , down_unit = primary_name )
227
227
228
228
# Verify that the database service got restarted and is ready in the old primary.
229
229
assert await is_postgresql_ready (ops_test , primary_name )
@@ -345,7 +345,7 @@ async def test_forceful_restart_without_data_and_transaction_logs(
345
345
assert new_primary_name is not None
346
346
assert new_primary_name != primary_name
347
347
348
- await are_writes_increasing (ops_test , primary_name )
348
+ await are_writes_increasing (ops_test , down_unit = primary_name )
349
349
350
350
# Change some settings to enable WAL rotation.
351
351
for unit in ops_test .model .applications [app ].units :
@@ -369,8 +369,14 @@ async def test_forceful_restart_without_data_and_transaction_logs(
369
369
# Check that the WAL was correctly rotated.
370
370
for unit_name in files :
371
371
assert not files [unit_name ].intersection (
372
- new_files
372
+ new_files [ unit_name ]
373
373
), "WAL segments weren't correctly rotated"
374
+ for file in files [unit_name ]:
375
+ run_command_on_unit (
376
+ ops_test ,
377
+ unit_name ,
378
+ f"rm -rf /var/snap/charmed-postgresql/common/var/lib/postgresql/pg_wal/{ file } " ,
379
+ )
374
380
375
381
# Start the systemd service in the old primary.
376
382
await run_command_on_unit (ops_test , primary_name , "snap start charmed-postgresql.patroni" )
@@ -428,7 +434,7 @@ async def test_network_cut(ops_test: OpsTest, continuous_writes, primary_start_t
428
434
429
435
async with ops_test .fast_forward ():
430
436
logger .info ("checking whether writes are increasing" )
431
- await are_writes_increasing (ops_test , primary_name )
437
+ await are_writes_increasing (ops_test , down_unit = primary_name )
432
438
433
439
logger .info ("checking whether a new primary was elected" )
434
440
# Verify that a new primary gets elected (ie old primary is secondary).
@@ -517,7 +523,7 @@ async def test_network_cut_without_ip_change(
517
523
518
524
async with ops_test .fast_forward ():
519
525
logger .info ("checking whether writes are increasing" )
520
- await are_writes_increasing (ops_test , primary_name , use_ip_from_inside = True )
526
+ await are_writes_increasing (ops_test , down_unit = primary_name , use_ip_from_inside = True )
521
527
522
528
logger .info ("checking whether a new primary was elected" )
523
529
# Verify that a new primary gets elected (ie old primary is secondary).
0 commit comments