Skip to content

Commit

Permalink
google_issue_tracker: support configurable URLs. (#4260)
Browse files Browse the repository at this point in the history
OSS-Fuzz needs something different to avoid an unnecessary redirect.
  • Loading branch information
oliverchang authored Sep 20, 2024
1 parent 37653b3 commit ad6131e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
from clusterfuzz._internal.metrics import logs

_NUM_RETRIES = 3
_ISSUE_TRACKER_URL = 'https://issues.chromium.org/issues'

# TODO: Make these configuration settings instead of hardcoded values in code.
# These custom fields use repeated enums.
Expand Down Expand Up @@ -951,6 +950,7 @@ def __init__(self, project, http_client, config):
self._client = http_client
self._default_component_id = config['default_component_id']
self._type = config['type'] if hasattr(config, 'type') else None
self._url = config['url']

@property
def client(self):
Expand Down Expand Up @@ -1062,13 +1062,13 @@ def find_issues(self, keywords=None, only_open=None):

def find_issues_url(self, keywords=None, only_open=None):
"""Finds issues (web URL)."""
return (_ISSUE_TRACKER_URL + '?' + urllib.parse.urlencode({
return (self._url + '?' + urllib.parse.urlencode({
'q': _get_query(keywords, only_open),
}))

def issue_url(self, issue_id):
"""Returns the issue URL with the given ID."""
return _ISSUE_TRACKER_URL + '/' + str(issue_id)
return self._url + '/' + str(issue_id)

@property
def label_type(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ def test_filed_issue_google_issue_tracker(self):
'type': 'google_issue_tracker',
'default_component_id': '1234567890',
'component_id': '123',
'url': 'https://issues.chromium.org/issues',
}
exp_issue_id = 68828938
self.mock._execute.return_value = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
TEST_CONFIG = {
'default_component_id': 1337,
'type': 'google-issue-tracker',
'url': 'https://issues.chromium.org/issues',
}

BASIC_ISSUE = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ def test_get_issue_tracker_google(self):
])
self.mock.get.return_value = {
'type': 'google_issue_tracker',
'default_component_id': 123
'default_component_id': 123,
'url': 'https://issues.chromium.org/issues',
}
self.mock._get_issue_tracker_manager_for_project.return_value = 'test_icm'
issue_tracker_utils._ISSUE_TRACKER_CONSTRUCTORS = {
Expand Down

0 comments on commit ad6131e

Please sign in to comment.