Skip to content

Commit

Permalink
Merge pull request #2089 from python-gitlab/jlvillal/more_time
Browse files Browse the repository at this point in the history
chore(ci): increase timeout for docker container to come online
  • Loading branch information
nejch committed Jun 24, 2022
2 parents 2194a44 + bda020b commit a825844
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions tests/functional/conftest.py
Expand Up @@ -154,8 +154,13 @@ def check_is_alive():
Return a healthcheck function fixture for the GitLab container spinup.
"""

def _check(container):
logging.info("Checking if GitLab container is up...")
def _check(container: str, start_time: float) -> bool:
setup_time = time.perf_counter() - start_time
minutes, seconds = int(setup_time / 60), int(setup_time % 60)
logging.info(
f"Checking if GitLab container is up. "
f"Have been checking for {minutes} minute(s), {seconds} seconds ..."
)
logs = ["docker", "logs", container]
return "gitlab Reconfigured!" in check_output(logs).decode()

Expand Down Expand Up @@ -191,11 +196,18 @@ def gitlab_config(check_is_alive, docker_ip, docker_services, temp_dir, fixture_
config_file = temp_dir / "python-gitlab.cfg"
port = docker_services.port_for("gitlab", 80)

start_time = time.perf_counter()
logging.info("Waiting for GitLab container to become ready.")
docker_services.wait_until_responsive(
timeout=200, pause=10, check=lambda: check_is_alive("gitlab-test")
timeout=300,
pause=10,
check=lambda: check_is_alive("gitlab-test", start_time=start_time),
)
setup_time = time.perf_counter() - start_time
minutes, seconds = int(setup_time / 60), int(setup_time % 60)
logging.info(
f"GitLab container is now ready after {minutes} minute(s), {seconds} seconds"
)
logging.info("GitLab container is now ready.")

token = set_token("gitlab-test", fixture_dir=fixture_dir)

Expand Down

0 comments on commit a825844

Please sign in to comment.