Skip to content
Snippets Groups Projects
Commit 0902af02 authored by Sascha Klawohn's avatar Sascha Klawohn
Browse files

Tweak group owner test retry

parent c3fa3409
No related branches found
No related tags found
2 merge requests!2421Removed direct infrastructure dependency from mkdocs macros,!2397Tweak group owner test retry
Pipeline #253582 passed
...@@ -224,7 +224,9 @@ def test_owner_not_member(auth_headers, client, group_molds, group_owner_not_mem ...@@ -224,7 +224,9 @@ def test_owner_not_member(auth_headers, client, group_molds, group_owner_not_mem
group.reload_without_clean() group.reload_without_clean()
return group.owner in group.members return group.owner in group.members
assert check_with_retry(condition) assert check_with_retry(condition, retries=10, delay0=0.2), (
'group in db not updated within expected time'
)
@pytest.mark.parametrize( @pytest.mark.parametrize(
......
...@@ -206,9 +206,10 @@ def dict_to_params(d): ...@@ -206,9 +206,10 @@ def dict_to_params(d):
def check_with_retry(condition_func, retries=5, delay0=0.1): def check_with_retry(condition_func, retries=5, delay0=0.1):
"""Call function, return early on truthy result. Retry with increasing delays."""
for attempt in range(retries): for attempt in range(retries):
if condition_func(): if result := condition_func():
return True return result
time.sleep(delay0 * (attempt + 1)) time.sleep(delay0 * (attempt + 1))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment