From 6a8a836b70cbef172f39d24685918324eb21673a Mon Sep 17 00:00:00 2001 From: Vector Li Date: Mon, 6 Nov 2023 19:40:42 +0800 Subject: [PATCH] Remove DEFAULT_GIT_CLONE_TIMEOUT Signed-off-by: Vector Li --- docs/overview.rst | 2 +- tmt/utils.py | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/overview.rst b/docs/overview.rst index f5047b36ef..4ac2540e42 100644 --- a/docs/overview.rst +++ b/docs/overview.rst @@ -419,7 +419,7 @@ TMT_GIT_CLONE_RETRIES TMT_GIT_CLONE_TIMEOUT Variable used to specify the timeout when cloning git repositories. - By default, its value is 3600 seconds. + By default, the variable is not set. Step Variables -------------- diff --git a/tmt/utils.py b/tmt/utils.py index f601125a0a..dde6d30a4e 100644 --- a/tmt/utils.py +++ b/tmt/utils.py @@ -204,7 +204,6 @@ def is_pidfile(cls, exit_code: Optional[int]) -> bool: # Defaults for GIT retries and timeouts DEFAULT_GIT_CLONE_RETRIES = 9 -DEFAULT_GIT_CLONE_TIMEOUT = 3600 # A stand-in variable for generic use. T = TypeVar('T') @@ -4840,8 +4839,9 @@ def git_clone( retries = retries or int(os.environ.get('TMT_GIT_CLONE_RETRIES', str(DEFAULT_GIT_CLONE_RETRIES))) - timeout = timeout or int(os.environ.get('TMT_GIT_CLONE_TIMEOUT', - str(DEFAULT_GIT_CLONE_TIMEOUT))) + if timeout is None: + value = os.environ.get('TMT_GIT_CLONE_TIMEOUT', None) + timeout = None if value is None else int(value) if can_change: url = clonable_git_url(url) @@ -4855,7 +4855,10 @@ def git_clone( ), env=env, timeout=timeout) except RunError: if not retries: - raise + # Do not raise because of negative test. For example, + # git clone https://github.com/beakerlib/THISDOESNTEXIST + # is expected to exit quietly. + return if not shallow: # Do not retry if shallow was not used raise