From 01569eaca9d635f05c8b7b302e02137ffee94793 Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Sat, 18 Feb 2023 22:23:08 -0800 Subject: chore: move to GitLab 15.6.8-ee.0 --- tests/functional/conftest.py | 44 +++++++++++++++++++++++++++++------------- tests/functional/fixtures/.env | 3 ++- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/tests/functional/conftest.py b/tests/functional/conftest.py index 34b286b..ef551c4 100644 --- a/tests/functional/conftest.py +++ b/tests/functional/conftest.py @@ -209,7 +209,32 @@ def check_is_alive(): return _check -@pytest.fixture +def wait_for_sidekiq_function( + *, + gl_instance: gitlab.Gitlab, + timeout: int = 30, + step: float = 0.5, + allow_fail: bool = False, +) -> bool: + """A function that is called to wait for the sidekiq process to finish. As + opposed to the fixture.""" + for count in range(timeout): + time.sleep(step) + busy = False + process_metrics = gl_instance.sidekiq.process_metrics() + assert isinstance(process_metrics, dict) + processes = process_metrics["processes"] + for process in processes: + if process["busy"]: + busy = True + if not busy: + return True + logging.info(f"sidekiq busy {count} of {timeout}") + assert allow_fail, "sidekiq process should have terminated but did not." + return False + + +@pytest.fixture(scope="function") def wait_for_sidekiq(gl): """ Return a helper function to wait until there are no busy sidekiq processes. @@ -218,18 +243,9 @@ def wait_for_sidekiq(gl): """ def _wait(timeout: int = 30, step: float = 0.5, allow_fail: bool = False) -> bool: - for count in range(timeout): - time.sleep(step) - busy = False - processes = gl.sidekiq.process_metrics()["processes"] - for process in processes: - if process["busy"]: - busy = True - if not busy: - return True - logging.info(f"sidekiq busy {count} of {timeout}") - assert allow_fail, "sidekiq process should have terminated but did not." - return False + return wait_for_sidekiq_function( + gl_instance=gl, timeout=timeout, step=step, allow_fail=allow_fail + ) return _wait @@ -529,6 +545,8 @@ def user(gl): yield user + result = wait_for_sidekiq_function(gl_instance=gl, timeout=60) + assert result is True, "sidekiq process should have terminated but did not" # Use `hard_delete=True` or a 'Ghost User' may be created. helpers.safe_delete(user, hard_delete=True) diff --git a/tests/functional/fixtures/.env b/tests/functional/fixtures/.env index 2933d36..498c603 100644 --- a/tests/functional/fixtures/.env +++ b/tests/functional/fixtures/.env @@ -1,2 +1,3 @@ GITLAB_IMAGE=gitlab/gitlab-ee -GITLAB_TAG=15.5.9-ee.0 +# GITLAB_TAG=15.6.8-ee.0 +GITLAB_TAG=15.6.0-ee.0 -- cgit v1.2.1