diff options
author | John L. Villalovos <john@sodarock.com> | 2023-02-18 22:23:08 -0800 |
---|---|---|
committer | John L. Villalovos <john@sodarock.com> | 2023-02-18 22:23:08 -0800 |
commit | 01569eaca9d635f05c8b7b302e02137ffee94793 (patch) | |
tree | 14f12671a09215fef7ff5ed36d9ad0b8f1f6403d | |
parent | d435782f358f0457433a760b7e04126114180931 (diff) | |
download | gitlab-jlvillal/bump_ee_version.tar.gz |
chore: move to GitLab 15.6.8-ee.0jlvillal/bump_ee_version
-rw-r--r-- | tests/functional/conftest.py | 44 | ||||
-rw-r--r-- | 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 |