@@ -159,7 +159,7 @@ async def test_kill_db_process(
159
159
await send_signal_to_process (ops_test , primary_name , process , "SIGKILL" )
160
160
161
161
async with ops_test .fast_forward ():
162
- await are_writes_increasing (ops_test , primary_name )
162
+ await are_writes_increasing (ops_test , down_unit = primary_name )
163
163
164
164
# Verify that the database service got restarted and is ready in the old primary.
165
165
assert await is_postgresql_ready (ops_test , primary_name )
@@ -193,7 +193,7 @@ async def test_freeze_db_process(
193
193
# considered to trigger a fail-over after primary_start_timeout is changed, and also
194
194
# when freezing the DB process it take some more time to trigger the fail-over).
195
195
try :
196
- await are_writes_increasing (ops_test , primary_name )
196
+ await are_writes_increasing (ops_test , down_unit = primary_name )
197
197
198
198
# Verify that a new primary gets elected (ie old primary is secondary).
199
199
for attempt in Retrying (stop = stop_after_delay (60 * 3 ), wait = wait_fixed (3 )):
@@ -227,7 +227,7 @@ async def test_restart_db_process(
227
227
await send_signal_to_process (ops_test , primary_name , process , "SIGTERM" )
228
228
229
229
async with ops_test .fast_forward ():
230
- await are_writes_increasing (ops_test , primary_name )
230
+ await are_writes_increasing (ops_test , down_unit = primary_name )
231
231
232
232
# Verify that the database service got restarted and is ready in the old primary.
233
233
assert await is_postgresql_ready (ops_test , primary_name )
@@ -310,7 +310,6 @@ async def test_full_cluster_restart(
310
310
311
311
@pytest .mark .group (1 )
312
312
@pytest .mark .abort_on_fail
313
- @pytest .mark .unstable
314
313
async def test_forceful_restart_without_data_and_transaction_logs (
315
314
ops_test : OpsTest ,
316
315
continuous_writes ,
@@ -349,7 +348,7 @@ async def test_forceful_restart_without_data_and_transaction_logs(
349
348
assert new_primary_name is not None
350
349
assert new_primary_name != primary_name
351
350
352
- await are_writes_increasing (ops_test , primary_name )
351
+ await are_writes_increasing (ops_test , down_unit = primary_name )
353
352
354
353
# Change some settings to enable WAL rotation.
355
354
for unit in ops_test .model .applications [app ].units :
@@ -373,8 +372,14 @@ async def test_forceful_restart_without_data_and_transaction_logs(
373
372
# Check that the WAL was correctly rotated.
374
373
for unit_name in files :
375
374
assert not files [unit_name ].intersection (
376
- new_files
375
+ new_files [ unit_name ]
377
376
), "WAL segments weren't correctly rotated"
377
+ for file in files [unit_name ]:
378
+ run_command_on_unit (
379
+ ops_test ,
380
+ unit_name ,
381
+ f"rm -rf /var/snap/charmed-postgresql/common/var/lib/postgresql/pg_wal/{ file } " ,
382
+ )
378
383
379
384
# Start the systemd service in the old primary.
380
385
await run_command_on_unit (ops_test , primary_name , "snap start charmed-postgresql.patroni" )
@@ -433,7 +438,7 @@ async def test_network_cut(ops_test: OpsTest, continuous_writes, primary_start_t
433
438
434
439
async with ops_test .fast_forward ():
435
440
logger .info ("checking whether writes are increasing" )
436
- await are_writes_increasing (ops_test , primary_name )
441
+ await are_writes_increasing (ops_test , down_unit = primary_name )
437
442
438
443
logger .info ("checking whether a new primary was elected" )
439
444
# Verify that a new primary gets elected (ie old primary is secondary).
@@ -523,7 +528,7 @@ async def test_network_cut_without_ip_change(
523
528
524
529
async with ops_test .fast_forward ():
525
530
logger .info ("checking whether writes are increasing" )
526
- await are_writes_increasing (ops_test , primary_name , use_ip_from_inside = True )
531
+ await are_writes_increasing (ops_test , down_unit = primary_name , use_ip_from_inside = True )
527
532
528
533
logger .info ("checking whether a new primary was elected" )
529
534
# Verify that a new primary gets elected (ie old primary is secondary).
0 commit comments