Repository: google/clusterfuzz

Issue:
Add feature to skip auto-closing of bugs once verified (needed for Android bugs)
Please remove auto close feature for Buganizer for Android bugs.  Android will be sure to close them out at the appropriate time - sometimes this means leaving the bug open after it has been fixed in mainline, but still hasn't been backported to older supported versions.  Android will be sure to close out the bugs when they have been fully resolved.  Thanks!


Discussion:
Intent is to still leave comment on verified (and add hotlist), but don't close bug status.

Resolving patch:
diff --git a/src/appengine/handlers/cron/cleanup.py b/src/appengine/handlers/cron/cleanup.py
--- a/src/appengine/handlers/cron/cleanup.py
+++ b/src/appengine/handlers/cron/cleanup.py
@@ -432,10 +432,14 @@ def mark_issue_as_closed_if_testcase_is_fixed(policy, testcase, issue):
     comment = _append_generic_incorrect_comment(comment, policy, issue,
                                                 ' and re-open the issue.')
 
-  issue.status = policy.status('verified')
+  skip_auto_close = data_handler.get_value_from_job_definition(
+      testcase.job_type, 'SKIP_AUTO_CLOSE_ISSUE')
+  if not skip_auto_close:
+    issue.status = policy.status('verified')
+
   issue.save(new_comment=comment, notify=True)
-  logs.log(
-      'Closed issue %d for fixed testcase %d.' % (issue.id, testcase.key.id()))
+  logs.log('Mark issue %d as verified for fixed testcase %d.' %
+           (issue.id, testcase.key.id()))
 
 
 def mark_unreproducible_testcase_as_fixed_if_issue_is_closed(testcase, issue):


Test patch:
diff --git a/src/python/tests/appengine/handlers/cron/cleanup_test.py b/src/python/tests/appengine/handlers/cron/cleanup_test.py
--- a/src/python/tests/appengine/handlers/cron/cleanup_test.py
+++ b/src/python/tests/appengine/handlers/cron/cleanup_test.py
@@ -367,6 +367,30 @@ def test_mark_issue_as_closed_if_testcase_is_fixed_10(self):
     self.assertNotEqual(self.issue.status, 'Verified')
     self.assertEqual('', self.issue._monorail_issue.comment)
 
+  def test_mark_issue_as_closed_if_testcase_is_fixed_11(self):
+    """Ensure that we mark issue as verified, but don't close it if job
+    definition specifies to skip it."""
+    testcase = test_utils.create_generic_testcase()
+    testcase.bug_information = str(self.issue.id)
+    testcase.fixed = '1:2'
+    testcase.open = False
+    testcase.one_time_crasher_flag = False
+    testcase.put()
+
+    data_types.Job(
+        name=testcase.job_type,
+        platform='LINUX',
+        environment_string=('SKIP_AUTO_CLOSE_ISSUE = True\n')).put()
+
+    cleanup.mark_issue_as_closed_if_testcase_is_fixed(
+        policy=self.policy, testcase=testcase, issue=self.issue)
+    self.assertIn(
+        'ClusterFuzz testcase 1 is verified as fixed in '
+        'https://test-clusterfuzz.appspot.com/revisions'
+        '?job=test_content_shell_drt&range=1:2',
+        self.issue._monorail_issue.comment)
+    self.assertEqual(self.issue.status, 'Assigned')
+
   def test_mark_testcase_as_closed_if_issue_is_closed_1(self):
     """Test that we don't do anything if testcase is already closed."""
     testcase = test_utils.create_generic_testcase()