@@ -303,3 +303,36 @@ def test_delete_old_logs(self, db: Session, client: TestClient, celery_session_w
303303 logs = db .exec (select (WebhookLog )).all ()
304304 # The log from 15 days ago is seconds older than the check and thus sdoesn't get deleted
305305 assert len (logs ) == 15
306+
307+ # Used for testing memory usage. Unnecessary for CI testing
308+ # @profile and install memory-profiler to use
309+ # def test_delete_old_logs_many(self, db: Session, client: TestClient, celery_session_worker):
310+ # eps = create_endpoint_from_dft_data()
311+ # for ep in eps:
312+ # db.add(ep)
313+ # db.commit()
314+ #
315+ # for i in range(0, 30):
316+ # whl = create_webhook_log_from_dft_data(
317+ # webhook_endpoint_id=ep.id,
318+ # timestamp=datetime.utcnow() - timedelta(days=i),
319+ # )
320+ # db.add(whl)
321+ # db.commit()
322+ #
323+ # for y in range(1000):
324+ # for i in range(1000):
325+ # whl = create_webhook_log_from_dft_data(
326+ # webhook_endpoint_id=ep.id,
327+ # timestamp=datetime.utcnow() - timedelta(days=20),
328+ # )
329+ # db.add(whl)
330+ # db.commit()
331+ #
332+ # logs = db.exec(select(WebhookLog)).all()
333+ # assert len(logs) == 1000030
334+ #
335+ # _delete_old_logs_job()
336+ # logs = db.exec(select(WebhookLog)).all()
337+ # # The log from 15 days ago is seconds older than the check and thus sdoesn't get deleted
338+ # assert len(logs) == 15
0 commit comments