From b1309ec12d8c6033638745e88beb2d78b4af5038 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Wed, 29 Nov 2023 16:34:51 -0700 Subject: [PATCH] run.util.find_git_parents: Drop refresh() This takes a long time, and can time out. The mirror is updated every ten minutes automatically. Signed-off-by: Zack Cerza --- teuthology/suite/test/test_util.py | 5 ++--- teuthology/suite/util.py | 8 -------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/teuthology/suite/test/test_util.py b/teuthology/suite/test/test_util.py index 042cdd1235..fa31abcd44 100644 --- a/teuthology/suite/test/test_util.py +++ b/teuthology/suite/test/test_util.py @@ -149,12 +149,11 @@ Branch 'no-branch' not found in repo: https://github.com/ceph/ceph-ci.git!" @patch('teuthology.suite.util.requests.get') def test_find_git_parents(self, m_requests_get): - refresh_resp = Mock(ok=True) history_resp = Mock(ok=True) history_resp.json.return_value = {'sha1s': ['sha1', 'sha1_p']} - m_requests_get.side_effect = [refresh_resp, history_resp] + m_requests_get.return_value = history_resp parent_sha1s = util.find_git_parents('ceph', 'sha1') - assert len(m_requests_get.mock_calls) == 2 + assert m_requests_get.call_count == 1 assert parent_sha1s == ['sha1_p'] diff --git a/teuthology/suite/util.py b/teuthology/suite/util.py index a4f0efa606..7e1ae35ccc 100644 --- a/teuthology/suite/util.py +++ b/teuthology/suite/util.py @@ -347,13 +347,6 @@ def find_git_parents(project: str, sha1: str, count=1): log.warning('githelper_base_url not set, --newest disabled') return [] - def refresh(project): - url = '%s/%s.git/refresh/' % (base_url, project) - resp = requests.get(url) - if not resp.ok: - log.error('git refresh failed for %s: %s', - project, resp.content.decode()) - def get_sha1s(project, committish, count): url = '/'.join((base_url, '%s.git' % project, 'history/?committish=%s&count=%d' % (committish, count))) @@ -366,7 +359,6 @@ def find_git_parents(project: str, sha1: str, count=1): int(count), sha1, project, resp.json()['error']) return sha1s - refresh(project) # index 0 will be the commit whose parents we want to find. # So we will query for count+1, and strip index 0 from the result. sha1s = get_sha1s(project, sha1, count + 1) -- 2.39.5