Skip to content

Commit

Permalink
Merge branch 'main' into 4455-redis-memory-spike-from-task-throttling…
Browse files Browse the repository at this point in the history
…-and-queue-buildup
  • Loading branch information
albertisfu authored Sep 26, 2024
2 parents 90e5a0e + 07096ff commit 1b0d2a8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cl/recap/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1485,7 +1485,8 @@ def test_only_the_docket_already_exists(self) -> None:
Alas, we fail. In theory, this shouldn't happen.
"""
self.de.delete()
rd = async_to_sync(process_recap_pdf)(self.pq.pk)
with mock.patch("cl.recap.tasks.asyncio.sleep"):
rd = async_to_sync(process_recap_pdf)(self.pq.pk)
self.assertIsNone(rd)
self.pq.refresh_from_db()
# Confirm PQ values.
Expand All @@ -1506,7 +1507,9 @@ def test_docket_and_docket_entry_already_exist(self, mock_extract):
self.assertTrue(rd.is_available)
self.assertTrue(rd.sha1)
self.assertTrue(rd.filepath_local)
self.assertIn("gov.uscourts.scotus.asdf.1.0", rd.filepath_local.name)
file_name = rd.filepath_local.name.split("/")[2]
self.assertIn("gov", file_name)
self.assertIn("uscourts.scotus.asdf.1.0", file_name)

mock_extract.assert_called_once()

Expand All @@ -1524,7 +1527,8 @@ def test_nothing_already_exists(self) -> None:
In practice, this shouldn't happen.
"""
self.docket.delete()
rd = async_to_sync(process_recap_pdf)(self.pq.pk)
with mock.patch("cl.recap.tasks.asyncio.sleep"):
rd = async_to_sync(process_recap_pdf)(self.pq.pk)
self.assertIsNone(rd)
self.pq.refresh_from_db()
# Confirm PQ values.
Expand Down

0 comments on commit 1b0d2a8

Please sign in to comment.