Skip to content

Commit 19fde8e

Browse files
fix: extend wait timeout for test_delete_user()
Have been seeing intermittent failures of the test_delete_user() functional test. Have made the following changes to hopefully resolve the issue and if it still fails to know better why the failure occurred. * Extend the wait timeout for test_delete_user() from 30 to 60 tries of 0.5 seconds each. * Modify wait_for_sidekiq() to return True if sidekiq process terminated. Return False if the timeout expired. * Modify wait_for_sidekiq() to loop through all processes instead of assuming there is only one process. If all processes are not busy then return. * Modify wait_for_sidekiq() to sleep at least once before checking for processes being busy. * Check for True being returned in test_delete_user() call to wait_for_sidekiq()
1 parent 2b29776 commit 19fde8e

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

tools/functional/api/test_users.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ def test_delete_user(gl, wait_for_sidekiq):
5656
)
5757

5858
new_user.delete()
59-
wait_for_sidekiq()
59+
result = wait_for_sidekiq(timeout=60)
60+
assert result == True, "sidekiq process should have terminated but did not"
6061

6162
assert new_user.id not in [user.id for user in gl.users.list()]
6263

tools/functional/conftest.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,15 @@ def wait_for_sidekiq(gl):
8989

9090
def _wait(timeout=30, step=0.5):
9191
for _ in range(timeout):
92-
if not gl.sidekiq.process_metrics()["processes"][0]["busy"]:
93-
return
9492
time.sleep(step)
93+
busy = False
94+
processes = gl.sidekiq.process_metrics()["processes"]
95+
for process in processes:
96+
if process["busy"]:
97+
busy = True
98+
if not busy:
99+
return True
100+
return False
95101

96102
return _wait
97103

0 commit comments

Comments
 (0)