@@ -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 )
@@ -306,7 +306,6 @@ async def test_full_cluster_restart(
306
306
307
307
308
308
@pytest .mark .group (1 )
309
- @pytest .mark .unstable
310
309
async def test_forceful_restart_without_data_and_transaction_logs (
311
310
ops_test : OpsTest ,
312
311
continuous_writes ,
@@ -345,7 +344,7 @@ async def test_forceful_restart_without_data_and_transaction_logs(
345
344
assert new_primary_name is not None
346
345
assert new_primary_name != primary_name
347
346
348
- await are_writes_increasing (ops_test , primary_name )
347
+ await are_writes_increasing (ops_test , down_unit = primary_name )
349
348
350
349
# Change some settings to enable WAL rotation.
351
350
for unit in ops_test .model .applications [app ].units :
@@ -369,8 +368,14 @@ async def test_forceful_restart_without_data_and_transaction_logs(
369
368
# Check that the WAL was correctly rotated.
370
369
for unit_name in files :
371
370
assert not files [unit_name ].intersection (
372
- new_files
371
+ new_files [ unit_name ]
373
372
), "WAL segments weren't correctly rotated"
373
+ for file in files [unit_name ]:
374
+ run_command_on_unit (
375
+ ops_test ,
376
+ unit_name ,
377
+ f"rm -rf /var/snap/charmed-postgresql/common/var/lib/postgresql/pg_wal/{ file } " ,
378
+ )
374
379
375
380
# Start the systemd service in the old primary.
376
381
await run_command_on_unit (ops_test , primary_name , "snap start charmed-postgresql.patroni" )
@@ -428,7 +433,7 @@ async def test_network_cut(ops_test: OpsTest, continuous_writes, primary_start_t
428
433
429
434
async with ops_test .fast_forward ():
430
435
logger .info ("checking whether writes are increasing" )
431
- await are_writes_increasing (ops_test , primary_name )
436
+ await are_writes_increasing (ops_test , down_unit = primary_name )
432
437
433
438
logger .info ("checking whether a new primary was elected" )
434
439
# Verify that a new primary gets elected (ie old primary is secondary).
@@ -517,7 +522,7 @@ async def test_network_cut_without_ip_change(
517
522
518
523
async with ops_test .fast_forward ():
519
524
logger .info ("checking whether writes are increasing" )
520
- await are_writes_increasing (ops_test , primary_name , use_ip_from_inside = True )
525
+ await are_writes_increasing (ops_test , down_unit = primary_name , use_ip_from_inside = True )
521
526
522
527
logger .info ("checking whether a new primary was elected" )
523
528
# Verify that a new primary gets elected (ie old primary is secondary).
0 commit comments