Skip to content
Snippets Groups Projects
Unverified Commit d6fb96e0 authored by Andrew Morgan's avatar Andrew Morgan Committed by GitHub
Browse files

Fix case in `wait_for_background_updates` where `self.store` does not exist (#11331)

Pull the DataStore from the HomeServer instance, which
always exists.
parent 26b5d232
No related branches found
No related tags found
No related merge requests found
A test helper (`wait_for_background_updates`) no longer depends on classes defining a `store` property.
......@@ -331,16 +331,13 @@ class HomeserverTestCase(TestCase):
time.sleep(0.01)
def wait_for_background_updates(self) -> None:
"""Block until all background database updates have completed.
Note that callers must ensure there's a store property created on the
testcase.
"""
"""Block until all background database updates have completed."""
store = self.hs.get_datastore()
while not self.get_success(
self.store.db_pool.updates.has_completed_background_updates()
store.db_pool.updates.has_completed_background_updates()
):
self.get_success(
self.store.db_pool.updates.do_next_background_update(False), by=0.1
store.db_pool.updates.do_next_background_update(False), by=0.1
)
def make_homeserver(self, reactor, clock):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment