Skip to content

Fix flaky tests #66

@imranariffin

Description

@imranariffin

At least this test (there's probably more) is a flaky. We need to ensure that it fails/succeeds consistently 99.99% of the time.

test_async_concurrency

One solution I can think of now is to just use a much bigger number of tasks and a bigger error margin. Even though the error margin is bigger, a much bigger of tasks would make up for it and make the error margin negligible.

-    results_actual = await asyncio.gather(*[simple_app.wait.apply_async(t_s=1) for _ in range(5)])
+    results_actual = await asyncio.gather(*[simple_app.wait.apply_async(t_s=1) for _ in range(20)])

-    error = 0.1
+    error = 0.5
    assert 1.0 < dt_actual < 1.0 + error
    # And the results should be correct
    results_expected = [1] * 20
    assert results_actual == results_expected

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions