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

Merge branch 'tweak-group-owner-test-retry' into 'develop'

Tweak group owner test retry

See merge request !2397
parents c3fa3409 0902af02
No related branches found
No related tags found
2 merge requests!2421Removed direct infrastructure dependency from mkdocs macros,!2397Tweak group owner test retry
Pipeline #254093 failed
...@@ -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