Skip to content

Commit 85089fa

Browse files
authored
google_issue_tracker: Set default priority. (#4379)
Otherwise new issues may error out because it's a required field.
1 parent 3c98f9c commit 85089fa

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/clusterfuzz/_internal/issue_management/google_issue_tracker/issue_tracker.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
_SEVERITY_LABEL_PREFIX = 'Security_Severity-'
4545

4646
_DEFAULT_SEVERITY = 'S4'
47+
_DEFAULT_PRIORITY = 'P4'
4748

4849

4950
class IssueAccessLevel(str, enum.Enum):
@@ -722,11 +723,10 @@ def save(self, new_comment=None, notify=True):
722723
"""Saves the issue."""
723724
if self._is_new:
724725
logs.info('google_issue_tracker: Creating new issue..')
725-
priority = _extract_label(self.labels, 'Pri-')
726+
priority = _extract_label(self.labels, 'Pri-') or _DEFAULT_PRIORITY
726727
issue_type = _extract_label(self.labels, 'Type-') or 'BUG'
727728
self._data['issueState']['type'] = issue_type
728-
if priority:
729-
self._data['issueState']['priority'] = priority
729+
self._data['issueState']['priority'] = priority
730730

731731
custom_field_entries = []
732732
oses = _sanitize_oses(_extract_all_labels(self.labels, 'OS-'))

src/clusterfuzz/_internal/tests/appengine/libs/issue_management/google_issue_tracker/google_issue_tracker_test.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ def test_new_issue(self):
258258
'hotlistIds': [12345],
259259
'type': 'BUG',
260260
'severity': 'S4',
261+
'priority': 'P4',
261262
},
262263
},
263264
templateOptions_applyTemplate=True,
@@ -300,7 +301,8 @@ def test_new_issue_with_limit_view_label(self):
300301
'status': 'ASSIGNED',
301302
'title': 'issue title',
302303
'type': 'BUG',
303-
'severity': 'S4'
304+
'severity': 'S4',
305+
'priority': 'P4',
304306
},
305307
'issueComment': {
306308
'comment': 'issue body'
@@ -371,6 +373,8 @@ def test_new_issue_with_os_foundin_releaseblock_labels(self):
371373
'foundInVersions': ['123', '789'],
372374
'severity':
373375
'S4',
376+
'priority':
377+
'P4',
374378
},
375379
'issueComment': {
376380
'comment': 'issue body'
@@ -403,6 +407,7 @@ def test_new_issue_with_empty_os_label(self):
403407
'title': 'issue title',
404408
'type': 'BUG',
405409
'severity': 'S4',
410+
'priority': 'P4',
406411
},
407412
},
408413
templateOptions_applyTemplate=True,
@@ -471,6 +476,8 @@ def test_new_issue_with_component_tags(self):
471476
'foundInVersions': ['123', '789'],
472477
'severity':
473478
'S4',
479+
'priority':
480+
'P4',
474481
},
475482
'issueComment': {
476483
'comment': 'issue body'
@@ -535,6 +542,8 @@ def test_new_security_issue(self):
535542
'Bug-Security',
536543
'severity':
537544
'S4',
545+
'priority':
546+
'P4',
538547
},
539548
'issueComment': {
540549
'comment': 'issue body'

0 commit comments

Comments
 (0)