Skip to content

Commit

Permalink
fix: Wait for a few seconds in test
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasfarias committed Sep 22, 2023
1 parent 28d83a9 commit 1d683c4
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions posthog/api/test/batch_exports/test_log_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,20 @@ def test_log_level_filter(batch_export, team):
BatchExportLogEntryLevel.ERROR,
BatchExportLogEntryLevel.DEBUG,
):
results = fetch_batch_export_log_entries(
team_id=team.pk,
batch_export_id=batch_export["id"],
level_filter=[level],
after=dt.datetime(2023, 9, 22, 0, 59, 59),
before=dt.datetime(2023, 9, 22, 1, 0, 1),
)
results = []
timeout = 10
start = dt.datetime.utcnow()

while not results:
results = fetch_batch_export_log_entries(
team_id=team.pk,
batch_export_id=batch_export["id"],
level_filter=[level],
after=dt.datetime(2023, 9, 22, 0, 59, 59),
before=dt.datetime(2023, 9, 22, 1, 0, 1),
)
if (dt.datetime.utcnow() - start) > dt.timedelta(seconds=timeout):
break

results.sort(key=lambda record: record.message)

Expand Down

0 comments on commit 1d683c4

Please sign in to comment.