Skip to content

Commit 2dcc0d4

Browse files
committed
test: recover PostgreSQL cache lock after termination
1 parent 7bbe5d1 commit 2dcc0d4

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

tests/pg_compat/test_common.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,17 @@ def test_terminated_fetch_releases_lock_without_continuing(self):
546546
self.assertEqual(process.returncode, 143)
547547
with self.assertRaises(ProcessLookupError):
548548
os.kill(child_pid, 0)
549+
550+
# Some CI shells leave the directory entry behind after a
551+
# signal interrupts a foreground wait. The next fetch must
552+
# still prove the stale owner is recoverable and does not
553+
# block future work.
554+
recovery_environment = environment.copy()
555+
recovery_environment.pop("STUB_BLOCK_STARTED")
556+
recovery_environment.pop("STUB_BLOCK_PID")
557+
recovery_environment.pop("STUB_BLOCK_FOREVER")
558+
recovered = self.run_fetch(recovery_environment, timeout=5)
559+
self.assertEqual(recovered.returncode, 0, recovered.stderr)
549560
self.assertFalse((cache / ".pg_compat.lock").exists())
550561
finally:
551562
if process.poll() is None:

0 commit comments

Comments
 (0)