-
Notifications
You must be signed in to change notification settings - Fork 564
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
There were some hardcoded constants that needed to be updated for the Google Issue Tracker migration. We'll also stop adding the 'Project' custom field for now, because it's hard to propagate custom field values and it's not essential for build failure issues. This should hopefully fix google/oss-fuzz#12536 (comment). Cherry-pick of #4378 Co-authored-by: Oliver Chang <[email protected]>
- Loading branch information
1 parent
437a1e7
commit 5646228
Showing
2 changed files
with
70 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,11 +20,66 @@ | |
|
||
from clusterfuzz._internal.cron import oss_fuzz_build_status | ||
from clusterfuzz._internal.datastore import data_types | ||
from clusterfuzz._internal.issue_management import issue_tracker_policy | ||
from clusterfuzz._internal.issue_management import monorail | ||
from clusterfuzz._internal.issue_management.monorail.issue import Issue | ||
from clusterfuzz._internal.tests.test_libs import helpers as test_helpers | ||
from clusterfuzz._internal.tests.test_libs import test_utils | ||
|
||
OSS_FUZZ_POLICY = issue_tracker_policy.IssueTrackerPolicy({ | ||
'status': { | ||
'assigned': 'Assigned', | ||
'duplicate': 'Duplicate', | ||
'verified': 'Verified', | ||
'new': 'New', | ||
'wontfix': 'WontFix', | ||
'fixed': 'Fixed' | ||
}, | ||
'all': { | ||
'status': 'new', | ||
'labels': ['ClusterFuzz', 'Stability-%SANITIZER%'], | ||
'issue_body_footer': | ||
'When you fix this bug, please\n' | ||
' * mention the fix revision(s).\n' | ||
' * state whether the bug was a short-lived regression or an old ' | ||
'bug in any stable releases.\n' | ||
' * add any other useful information.\n' | ||
'This information can help downstream consumers.\n\n' | ||
'If you need to contact the OSS-Fuzz team with a question, ' | ||
'concern, or any other feedback, please file an issue at ' | ||
'https://github.com/google/oss-fuzz/issues.' | ||
}, | ||
'non_security': { | ||
'labels': ['Type-Bug'] | ||
}, | ||
'labels': { | ||
'ignore': 'ClusterFuzz-Ignore', | ||
'verified': 'ClusterFuzz-Verified', | ||
'security_severity': 'Security_Severity-%SEVERITY%', | ||
'needs_feedback': 'Needs-Feedback', | ||
'invalid_fuzzer': 'ClusterFuzz-Invalid-Fuzzer', | ||
'reported': 'Reported-%YYYY-MM-DD%', | ||
'wrong': 'ClusterFuzz-Wrong', | ||
'fuzz_blocker': 'Fuzz-Blocker', | ||
'reproducible': 'Reproducible', | ||
'auto_cc_from_owners': 'ClusterFuzz-Auto-CC', | ||
'os': 'OS-%PLATFORM%', | ||
'unreproducible': 'Unreproducible', | ||
'restrict_view': 'Restrict-View-Commit' | ||
}, | ||
'security': { | ||
'labels': ['Type-Bug-Security'] | ||
}, | ||
'deadline_policy_message': | ||
'This bug is subject to a 90 day disclosure deadline. If 90 days ' | ||
'elapse\n' | ||
'without an upstream patch, then the bug report will automatically\n' | ||
'become visible to the public.', | ||
'existing': { | ||
'labels': ['Stability-%SANITIZER%'] | ||
} | ||
}) | ||
|
||
|
||
class MockResponse: | ||
"""Mock url request's response.""" | ||
|
@@ -67,6 +122,8 @@ def setUp(self): | |
test_helpers.patch(self, [ | ||
'clusterfuzz._internal.base.utils.utcnow', | ||
'handlers.base_handler.Handler.is_cron', | ||
('policy_get', | ||
'clusterfuzz._internal.issue_management.issue_tracker_policy.get'), | ||
'clusterfuzz._internal.issue_management.issue_tracker_utils.get_issue_tracker', | ||
'clusterfuzz._internal.metrics.logs.error', | ||
'requests.get', | ||
|
@@ -77,6 +134,7 @@ def setUp(self): | |
|
||
self.itm = IssueTrackerManager('oss-fuzz') | ||
self.mock.get_issue_tracker.return_value = monorail.IssueTracker(self.itm) | ||
self.mock.policy_get.return_value = OSS_FUZZ_POLICY | ||
|
||
self.maxDiff = None | ||
|
||
|
@@ -386,8 +444,6 @@ def _mock_requests_get(url, timeout=None): | |
'**This bug will be automatically closed within a ' | ||
'day once it is fixed.**', issue.body) | ||
|
||
self.assertTrue(issue.has_label('Proj-proj2')) | ||
|
||
issue = self.itm.issues[2] | ||
self.assertCountEqual(['[email protected]'], issue.cc) | ||
self.assertEqual('New', issue.status) | ||
|
@@ -407,8 +463,6 @@ def _mock_requests_get(url, timeout=None): | |
'**This bug will be automatically closed within a ' | ||
'day once it is fixed.**', issue.body) | ||
|
||
self.assertTrue(issue.has_label('Proj-proj6')) | ||
|
||
def test_recovered_build_failure(self): | ||
"""Test fixed build failures.""" | ||
# Use the same status for all build types. | ||
|
@@ -436,7 +490,6 @@ def test_recovered_build_failure(self): | |
issue = Issue() | ||
issue.open = True | ||
issue.add_label('Type-Build-Failure') | ||
issue.add_label('Proj-proj2') | ||
issue.summary = 'Build failure in proj2' | ||
issue.body = 'Build failure' | ||
|
||
|
@@ -446,7 +499,7 @@ def test_recovered_build_failure(self): | |
self.assertEqual(0, data_types.OssFuzzBuildFailure.query().count()) | ||
|
||
issue = self.itm.issues[1] | ||
self.assertEqual('Fixed', issue.status) | ||
self.assertEqual('Verified', issue.status) | ||
self.assertEqual('The latest build has succeeded, closing this issue.', | ||
issue.comment) | ||
|
||
|