diff options
author | Erik Johnston <erik@matrix.org> | 2021-07-20 14:24:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-20 14:24:25 +0100 |
commit | 54389d5697622f1beffaeda96d9c6da7ef7d93a9 (patch) | |
tree | 8e557666edbca114d09fbd002a1d8510644792d3 /tests/storage | |
parent | Combine some changelog lines in the documentation section (diff) | |
download | synapse-54389d5697622f1beffaeda96d9c6da7ef7d93a9.tar.xz |
Fix dropping locks on shut down (#10433)
Diffstat (limited to 'tests/storage')
-rw-r--r-- | tests/storage/databases/main/test_lock.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/storage/databases/main/test_lock.py b/tests/storage/databases/main/test_lock.py index 9ca70e7367..d326a1d6a6 100644 --- a/tests/storage/databases/main/test_lock.py +++ b/tests/storage/databases/main/test_lock.py @@ -98,3 +98,16 @@ class LockTestCase(unittest.HomeserverTestCase): lock2 = self.get_success(self.store.try_acquire_lock("name", "key")) self.assertIsNotNone(lock2) + + def test_shutdown(self): + """Test that shutting down Synapse releases the locks""" + # Acquire two locks + lock = self.get_success(self.store.try_acquire_lock("name", "key1")) + self.assertIsNotNone(lock) + lock2 = self.get_success(self.store.try_acquire_lock("name", "key2")) + self.assertIsNotNone(lock2) + + # Now call the shutdown code + self.get_success(self.store._on_shutdown()) + + self.assertEqual(self.store._live_tokens, {}) |