Skip to content

Commit 1081866

Browse files
authored
Tests - check clean WFQ; wave spacing (#124)
Check queue is clean after the one-at-a-time rate limited test. test_one_at_a_time_with_limiter did not check `queue_entries_are_cleaned_up`, but the test it copied from (test_one_at_a_time) did. Also, the wave spacing calc looked sus to me. Give a little more tolerance on the calculations. GH runner is failing them occasionally - for example off by .14s where the tolerance was .1...
1 parent 809bdbc commit 1081866

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/test_queue.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ def workflow_two() -> None:
121121
assert handle2.get_result() == None
122122
assert flag
123123
assert wf_counter == 1
124+
assert queue_entries_are_cleaned_up(dbos)
124125

125126

126127
def test_queue_childwf(dbos: DBOS) -> None:
@@ -226,11 +227,12 @@ def test_workflow(var1: str, var2: str) -> float:
226227
# Verify that each "wave" of tasks started at the ~same time.
227228
for wave in range(num_waves):
228229
for i in range(wave * limit, (wave + 1) * limit - 1):
229-
assert times[i + 1] - times[i] < 0.1
230+
assert times[i + 1] - times[i] < 0.2
230231

231232
# Verify that the gap between "waves" is ~equal to the period
232233
for wave in range(num_waves - 1):
233-
assert times[limit * wave] - times[limit * wave - 1] < period + 0.1
234+
assert times[limit * (wave + 1)] - times[limit * wave] > period - 0.2
235+
assert times[limit * (wave + 1)] - times[limit * wave] < period + 0.2
234236

235237
# Verify all workflows get the SUCCESS status eventually
236238
dbos._sys_db.wait_for_buffer_flush()

0 commit comments

Comments
 (0)