def GetSwarmingTaskRequestTemplate(): """Returns a template SwarmingTaskRequest object with default values.""" return SwarmingTaskRequest( created_ts=None, expiration_secs='3600', name='', parent_task_id='', priority='150', properties=SwarmingTaskProperties( caches=[], command=None, dimensions=[], env=[], env_prefixes=[], execution_timeout_secs='3600', extra_args=ListOfBasestring(), grace_period_secs='30', io_timeout_secs='1200', idempotent=True, inputs_ref=SwarmingTaskInputsRef( isolated=None, isolatedserver=None, namespace=None), cipd_input=CIPDInput( packages=CIPDPackages(), client_package=CIPDClientPackage( version=None, package_name=None, ), server=None), ), pubsub_auth_token=None, pubsub_topic=None, pubsub_userdata=None, service_account=None, tags=ListOfBasestring(), user='')
def testGetSwarmingTaskRequestTemplate(self): expected_request = SwarmingTaskRequest( created_ts=None, expiration_secs='3600', name='', parent_task_id='', priority='150', properties=SwarmingTaskProperties(caches=[], command=None, dimensions=[], env=[], env_prefixes=[], execution_timeout_secs='3600', extra_args=ListOfBasestring(), grace_period_secs='30', io_timeout_secs='1200', idempotent=True, inputs_ref=SwarmingTaskInputsRef( isolated=None, isolatedserver=None, namespace=None)), pubsub_auth_token=None, pubsub_topic=None, pubsub_userdata=None, service_account=None, tags=ListOfBasestring(), user='') self.assertEqual(expected_request, SwarmingTaskRequest.GetSwarmingTaskRequestTemplate())
def testIdentifyCulpritForCompileTryJobSuccess(self, mock_fn): master_name = 'm' builder_name = 'b' build_number = 1 try_job_id = '1' compile_result = { 'report': { 'result': { 'rev1': 'passed', 'rev2': 'failed' }, 'culprit': 'rev2' }, 'try_job_id': try_job_id, } repo_name = 'chromium' revision = 'rev2' culprit = WfSuspectedCL.Create(repo_name, revision, 100) culprit.put() culprits_result = { 'rev2': { 'revision': revision, 'commit_position': 2, 'url': 'url_2', 'repo_name': repo_name } } mock_fn.return_value = culprits_result, ListOfBasestring() culprits = DictOfBasestring() culprits['rev2'] = culprit.key.urlsafe() self.MockGeneratorPipeline(pipeline_class=revert_pipeline. RevertAndNotifyCompileCulpritPipeline, expected_input=CulpritActionParameters( build_key=BuildKey( master_name=master_name, builder_name=builder_name, build_number=build_number), culprits=culprits, heuristic_cls=ListOfBasestring(), failure_to_culprit_map=None), mocked_output=False) pipeline_input = IdentifyCompileTryJobCulpritParameters( build_key=BuildKey(master_name=master_name, builder_name=builder_name, build_number=build_number), result=CompileTryJobResult.FromSerializable(compile_result)) pipeline = culprit_pipeline.IdentifyCompileTryJobCulpritPipeline( pipeline_input) pipeline.start() self.execute_queued_tasks()
def setUp(self): super(TestCulpritActionTest, self).setUp() repo_name = 'chromium' revision = 'rev1' self.culprit = WfSuspectedCL.Create(repo_name, revision, 100).put().urlsafe() culprit_dict = DictOfBasestring() culprit_dict[revision] = self.culprit heuristic_cls = ListOfBasestring() heuristic_cls.append(self.culprit) parameters_dict = { 'build_key': { 'master_name': 'm', 'builder_name': 'b', 'build_number': 123 }, 'culprits': { 'rev1': self.culprit }, 'heuristic_cls': heuristic_cls } self.parameters = CulpritActionParameters.FromSerializable( parameters_dict)
def testScheduleFlakeTryJobRaise(self, *_): master_name = 'm' builder_name = 'b' build_number = 123 step_name = 's' test_name = 't' revision = 'r1000' analysis = MasterFlakeAnalysis.Create(master_name, builder_name, build_number, step_name, test_name) analysis.Save() try_job = FlakeTryJob.Create(master_name, builder_name, step_name, test_name, revision) try_job.put() parameters = RunFlakeTryJobParameters( analysis_urlsafe_key=analysis.key.urlsafe(), revision=revision, flake_cache_name=None, isolate_target_name='target', dimensions=ListOfBasestring()) with self.assertRaises(exceptions.RetryException): flake_try_job.ScheduleFlakeTryJob(parameters, 'pipeline')
def testCanAutoCreateRevert(self, _): repo_name = 'chromium' revision = 'rev1' culprit = WfSuspectedCL.Create(repo_name, revision, 123) culprit.failure_type.append(failure_type.TEST) culprit.revert_created_time = datetime(2018, 2, 14, 12, 0, 0) culprit.put() culprit_dict = DictOfBasestring() culprit_dict[revision] = culprit.key.urlsafe() heuristic_cls = ListOfBasestring() heuristic_cls.append(culprit.key.urlsafe()) parameters_dict = { 'build_key': { 'master_name': 'm', 'builder_name': 'b', 'build_number': 123 }, 'culprits': { 'rev1': culprit.key.urlsafe() }, 'heuristic_cls': heuristic_cls } parameters = CulpritActionParameters.FromSerializable(parameters_dict) self.assertTrue( test_culprit_action.CanAutoCreateRevert(culprit.key.urlsafe(), parameters))
def testSendNotificationForTestCulpritNoRevert(self, *_): master_name = 'm' builder_name = 'b' build_number = 124 cl_key = 'mockurlsafekey' culprits = DictOfBasestring() culprits['r1'] = cl_key heuristic_cls = ListOfBasestring() heuristic_cls.append(cl_key) failure_to_culprit_map = FailureToCulpritMap.FromSerializable( {'step1': { 't1': 'r1' }}) input_object = SendNotificationForCulpritParameters( cl_key=cl_key, force_notify=True, revert_status=services_constants.SKIPPED, failure_type=failure_type.TEST) self.MockSynchronousPipeline(SendNotificationForCulpritPipeline, input_object, True) pipeline = RevertAndNotifyTestCulpritPipeline( CulpritActionParameters( build_key=BuildKey(master_name=master_name, builder_name=builder_name, build_number=build_number), culprits=culprits, heuristic_cls=heuristic_cls, failure_to_culprit_map=failure_to_culprit_map)) pipeline.start(queue_name=constants.DEFAULT_QUEUE) self.execute_queued_tasks()
def testRunImplRetryUponFailure(self, mocked_schedule, mocked_save, mocked_pipeline_id, _): master_name = 'm' builder_name = 'b' build_number = 1 step_name = 's' test_name = 't' isolate_target_name = 'target' revision = 'r1000' analysis = MasterFlakeAnalysis.Create(master_name, builder_name, build_number, step_name, test_name) analysis.Save() try_job = FlakeTryJob.Create(master_name, builder_name, step_name, test_name, revision) try_job.put() pipeline_input = RunFlakeTryJobParameters( analysis_urlsafe_key=analysis.key.urlsafe(), flake_cache_name=None, dimensions=ListOfBasestring(), revision=revision, isolate_target_name=isolate_target_name, urlsafe_try_job_key=try_job.key.urlsafe()) mocked_pipeline_id.__get__ = mock.Mock(return_value='pipeline-id') pipeline_job = RunFlakeTryJobPipeline(pipeline_input) with self.assertRaises(pipeline.Retry): pipeline_job.RunImpl(pipeline_input) mocked_schedule.assert_called_once_with(pipeline_input, 'pipeline-id') self.assertFalse(mocked_save.called)
def testRunImplTriggerSameJobTwice(self, mocked_schedule, _): master_name = 'm' builder_name = 'b' build_number = 1 step_name = 's' test_name = 't' revision = 'r1000' analysis = MasterFlakeAnalysis.Create(master_name, builder_name, build_number, step_name, test_name) analysis.Save() try_job = FlakeTryJob.Create(master_name, builder_name, step_name, test_name, revision) try_job.put() pipeline_input = RunFlakeTryJobParameters( analysis_urlsafe_key=analysis.key.urlsafe(), flake_cache_name=None, dimensions=ListOfBasestring(), revision=revision, isolate_target_name='target', urlsafe_try_job_key=try_job.key.urlsafe()) try_job_pipeline = RunFlakeTryJobPipeline(pipeline_input) try_job_pipeline.RunImpl(pipeline_input) self.assertFalse(mocked_schedule.called)
def testSendNotificationLatestBuildPassed(self, mocked_pipeline, _): master_name = 'm' builder_name = 'b' build_number = 124 cl_key = 'mockurlsafekey' culprits = DictOfBasestring() culprits['r1'] = cl_key heuristic_cls = ListOfBasestring() heuristic_cls.append(cl_key) failure_to_culprit_map = FailureToCulpritMap.FromSerializable( {'step1': { 't1': 'r1' }}) pipeline = RevertAndNotifyTestCulpritPipeline( CulpritActionParameters( build_key=BuildKey(master_name=master_name, builder_name=builder_name, build_number=build_number), culprits=culprits, heuristic_cls=heuristic_cls, failure_to_culprit_map=failure_to_culprit_map)) pipeline.start(queue_name=constants.DEFAULT_QUEUE) self.execute_queued_tasks() self.assertFalse(mocked_pipeline.called)
def testReturnNoneIfNoTryJob(self): master_name = 'm' builder_name = 'b' build_number = 8 WfTryJob.Create(master_name, builder_name, build_number).put() self.MockGeneratorPipeline( pipeline_class=RevertAndNotifyTestCulpritPipeline, expected_input=CulpritActionParameters( build_key=BuildKey(master_name=master_name, builder_name=builder_name, build_number=build_number), culprits=DictOfBasestring(), heuristic_cls=ListOfBasestring(), failure_to_culprit_map=None), mocked_output=False) parameters = IdentifyTestTryJobCulpritParameters(build_key=BuildKey( master_name=master_name, builder_name=builder_name, build_number=build_number), result=None) pipeline = IdentifyTestTryJobCulpritPipeline(parameters) pipeline.start() self.execute_queued_tasks() try_job = WfTryJob.Get(master_name, builder_name, build_number) self.assertEqual(try_job.test_results, []) self.assertEqual(try_job.status, analysis_status.COMPLETED)
def testGetCulpritsShouldTakeActions(self, _): master_name = 'm' builder_name = 'b' build_number = 124 culprits = DictOfBasestring() culprits['r1'] = 'mockurlsafekey' culprits['r2'] = 'mockurlsafekey2' failure_to_culprit_map = FailureToCulpritMap.FromSerializable({ 'step1': { 'test1': 'r1', 'test2': 'r2' }, 'step2': { 'test1': 'r2' } }) parameters = CulpritActionParameters( build_key=BuildKey(master_name=master_name, builder_name=builder_name, build_number=build_number), culprits=culprits, heuristic_cls=ListOfBasestring(), failure_to_culprit_map=failure_to_culprit_map) self.assertEqual( set(['r1']), test_culprit_action.GetCulpritsShouldTakeActions(parameters))
def testCallbackImplFailedRun(self, mocked_state_changed): master_name = 'm' builder_name = 'b' build_number = 1 step_name = 's' test_name = 't' revision = 'r1000' isolate_target_name = 'target' try_job_id = 'try_job_id' analysis = MasterFlakeAnalysis.Create(master_name, builder_name, build_number, step_name, test_name) analysis.Save() try_job = FlakeTryJob.Create(master_name, builder_name, step_name, test_name, revision) try_job.put() pipeline_input = RunFlakeTryJobParameters( analysis_urlsafe_key=analysis.key.urlsafe(), flake_cache_name=None, dimensions=ListOfBasestring(), revision=revision, isolate_target_name=isolate_target_name, urlsafe_try_job_key=try_job.key.urlsafe()) pipeline_job = RunFlakeTryJobPipeline(pipeline_input) returned_value = pipeline_job.CallbackImpl(pipeline_input, { 'try_job_id': try_job_id, 'build_json': '{"k":"v"}' }) self.assertEqual(('Error updating try job result: m', None), returned_value) mocked_state_changed.assert_called_once_with(try_job_id, {'k': 'v'})
def testIdentifyCulpritForTestTryJobSuccess(self, mock_fn, mock_fn2): master_name = 'm' builder_name = 'b' build_number = 1 repo_name = 'chromium' revision = 'rev2' culprit = WfSuspectedCL.Create(repo_name, revision, 100) culprit.put() culprits_result = { 'rev1': { 'revision': 'rev1', 'repo_name': 'chromium', 'commit_position': 1, 'url': 'url_1' }, 'rev2': { 'revision': revision, 'commit_position': 2, 'url': 'url_2', 'repo_name': repo_name } } culprit_map = {'step': {'test1': 'rev1', 'test2': 'rev2'}} mock_fn.return_value = culprits_result, ListOfBasestring.FromSerializable( []), FailureToCulpritMap.FromSerializable(culprit_map) culprits = DictOfBasestring() culprits['rev2'] = culprit.key.urlsafe() mock_fn2.return_value = culprits self.MockGeneratorPipeline( pipeline_class=RevertAndNotifyTestCulpritPipeline, expected_input=CulpritActionParameters( build_key=BuildKey(master_name=master_name, builder_name=builder_name, build_number=build_number), culprits=culprits, heuristic_cls=ListOfBasestring(), failure_to_culprit_map=FailureToCulpritMap.FromSerializable( culprit_map)), mocked_output=False) parameters = IdentifyTestTryJobCulpritParameters( build_key=BuildKey(master_name=master_name, builder_name=builder_name, build_number=build_number), result=TestTryJobResult.FromSerializable({})) pipeline = IdentifyTestTryJobCulpritPipeline(parameters) pipeline.start() self.execute_queued_tasks() mock_fn.assert_called_once_with(parameters)
def testShouldTakeActionsOnCulprit(self, _): master_name = 'm' builder_name = 'b' build_number = 124 culprits = DictOfBasestring() culprits['r1'] = 'mockurlsafekey' parameters = CulpritActionParameters(build_key=BuildKey( master_name=master_name, builder_name=builder_name, build_number=build_number), culprits=culprits, heuristic_cls=ListOfBasestring()) self.assertTrue( compile_culprit_action.ShouldTakeActionsOnCulprit(parameters))
def testSendNotificationToConfirmRevert(self, *_): master_name = 'm' builder_name = 'b' build_number = 124 build_key = 'm/b/124' cl_key = 'mockurlsafekey' culprits = DictOfBasestring() culprits['r1'] = cl_key heuristic_cls = ListOfBasestring() heuristic_cls.append(cl_key) self.MockSynchronousPipeline( CreateRevertCLPipeline, CreateRevertCLParameters(cl_key=cl_key, build_key=build_key, failure_type=failure_type.COMPILE), services_constants.CREATED_BY_FINDIT) self.MockSynchronousPipeline( SubmitRevertCLPipeline, SubmitRevertCLParameters( cl_key=cl_key, revert_status=services_constants.CREATED_BY_FINDIT, failure_type=failure_type.COMPILE), services_constants.COMMITTED) self.MockSynchronousPipeline( SendNotificationToIrcPipeline, SendNotificationToIrcParameters( cl_key=cl_key, revert_status=services_constants.CREATED_BY_FINDIT, commit_status=services_constants.COMMITTED, failure_type=failure_type.COMPILE), True) self.MockSynchronousPipeline( SendNotificationForCulpritPipeline, SendNotificationForCulpritParameters( cl_key=cl_key, force_notify=True, revert_status=services_constants.CREATED_BY_FINDIT, failure_type=failure_type.COMPILE), True) pipeline = wrapper_pipeline.RevertAndNotifyCompileCulpritPipeline( CulpritActionParameters(build_key=BuildKey( master_name=master_name, builder_name=builder_name, build_number=build_number), culprits=culprits, heuristic_cls=heuristic_cls, failure_to_culprit_map=None)) pipeline.start(queue_name=constants.DEFAULT_QUEUE) self.execute_queued_tasks()
def GetHeuristicSuspectedCLs(master_name, builder_name, build_number): """Gets revisions of suspected cls found by heuristic approach.""" analysis = WfAnalysis.Get(master_name, builder_name, build_number) suspects = ListOfBasestring() if analysis and analysis.suspected_cls: for cl in analysis.suspected_cls: culprit = WfSuspectedCL.Get(cl['repo_name'], cl['revision']) if not culprit: # pragma: no cover logging.warning( 'No culprit found for repo_name %s and revision %s', cl['repo_name'], cl['revision']) continue suspects.append(culprit.key.urlsafe()) return suspects
def testCreatedRevertButNotCommitted(self, *_): master_name = 'm' builder_name = 'b' build_number = 124 build_key = 'm/b/124' cl_key = 'mockurlsafekey' culprits = DictOfBasestring() culprits['r1'] = cl_key heuristic_cls = ListOfBasestring() heuristic_cls.append(cl_key) failure_to_culprit_map = FailureToCulpritMap.FromSerializable( {'step1': { 't1': 'r1' }}) self.MockSynchronousPipeline( CreateRevertCLPipeline, CreateRevertCLParameters(cl_key=cl_key, build_key=build_key, failure_type=failure_type.TEST), services_constants.CREATED_BY_FINDIT) self.MockSynchronousPipeline( SendNotificationForCulpritPipeline, SendNotificationForCulpritParameters( cl_key=cl_key, force_notify=True, revert_status=services_constants.CREATED_BY_FINDIT, failure_type=failure_type.TEST), True) pipeline = RevertAndNotifyTestCulpritPipeline( CulpritActionParameters( build_key=BuildKey(master_name=master_name, builder_name=builder_name, build_number=build_number), culprits=culprits, heuristic_cls=heuristic_cls, failure_to_culprit_map=failure_to_culprit_map)) pipeline.start(queue_name=constants.DEFAULT_QUEUE) self.execute_queued_tasks()
def testScheduleFlakeTryJobSuccess(self, *_): master_name = 'm' builder_name = 'b' build_number = 123 step_name = 's' test_name = 't' revision = 'r1000' expected_try_job_id = 'id' analysis = MasterFlakeAnalysis.Create(master_name, builder_name, build_number, step_name, test_name) analysis.Save() try_job = FlakeTryJob.Create(master_name, builder_name, step_name, test_name, revision) try_job.put() parameters = RunFlakeTryJobParameters( analysis_urlsafe_key=analysis.key.urlsafe(), revision=revision, flake_cache_name=None, dimensions=ListOfBasestring(), isolate_target_name='target', urlsafe_try_job_key=try_job.key.urlsafe()) try_job_id = flake_try_job.ScheduleFlakeTryJob(parameters, 'pipeline') try_job = FlakeTryJob.Get(master_name, builder_name, step_name, test_name, revision) try_job_data = FlakeTryJobData.Get(expected_try_job_id) expected_try_job_id = 'id' self.assertEqual(expected_try_job_id, try_job_id) self.assertEqual(expected_try_job_id, try_job.flake_results[-1]['try_job_id']) self.assertTrue(expected_try_job_id in try_job.try_job_ids) self.assertIsNotNone(try_job_data) self.assertEqual(try_job_data.master_name, master_name) self.assertEqual(try_job_data.builder_name, builder_name)
def testOnTimeout(self, mocked_OnTryJobTimeout): master_name = 'm' builder_name = 'b' build_number = 123 step_name = 's' test_name = 't' analysis = MasterFlakeAnalysis.Create(master_name, builder_name, build_number, step_name, test_name) analysis.Save() revision = 'r1000' try_job_url = 'url' try_job_id = 'try_job_id' try_job = FlakeTryJob.Create(master_name, builder_name, step_name, test_name, revision) try_job_data = FlakeTryJobData.Create(try_job_id) try_job_data.try_job_key = try_job.key try_job_data.try_job_url = try_job_url try_job_data.put() try_job.flake_results = [{ 'report': None, 'url': try_job_url, 'try_job_id': try_job_id, }] try_job.status = analysis_status.RUNNING try_job.put() pipeline_input = RunFlakeTryJobParameters( analysis_urlsafe_key=analysis.key.urlsafe(), flake_cache_name=None, dimensions=ListOfBasestring(), revision=revision, isolate_target_name='target', urlsafe_try_job_key=try_job.key.urlsafe()) p = RunFlakeTryJobPipeline(pipeline_input) p.OnTimeout(pipeline_input, {'try_job_id': try_job_id}) mocked_OnTryJobTimeout.assert_called_once_with(try_job_id, failure_type.FLAKY_TEST)
def testShouldForceNotify(self): cl_key = 'mockurlsafekey' culprit_dict = DictOfBasestring() culprit_dict['rev1'] = cl_key heuristic_cls = ListOfBasestring() heuristic_cls.append(cl_key) parameters_dict = { 'build_key': { 'master_name': 'm', 'builder_name': 'b', 'build_number': 123 }, 'culprits': { 'rev1': culprit_dict }, 'heuristic_cls': heuristic_cls } self.assertTrue( culprit_action.ShouldForceNotify( cl_key, CulpritActionParameters.FromSerializable(parameters_dict)))
def testCallbackImplNoTryJobID(self, mocked_pipeline_id, mocked_state_changed): mocked_pipeline_id.__get__ = mock.Mock(return_value='pipeline-id') master_name = 'm' builder_name = 'b' build_number = 1 step_name = 's' test_name = 't' isolate_target_name = 'target' revision = 'r1000' analysis = MasterFlakeAnalysis.Create(master_name, builder_name, build_number, step_name, test_name) analysis.Save() try_job = FlakeTryJob.Create(master_name, builder_name, step_name, test_name, revision) try_job.put() pipeline_input = RunFlakeTryJobParameters( analysis_urlsafe_key=analysis.key.urlsafe(), flake_cache_name=None, dimensions=ListOfBasestring(), revision=revision, isolate_target_name=isolate_target_name, urlsafe_try_job_key=try_job.key.urlsafe()) pipeline_job = RunFlakeTryJobPipeline(pipeline_input) returned_value = pipeline_job.CallbackImpl(pipeline_input, {'build_json': '{"k":"v"}'}) self.assertEqual( ('Try_job_id not found for pipeline pipeline-id', None), returned_value) self.assertFalse(mocked_state_changed.called)
def testGetTryJobsForFlakeSuccess(self, mocked_schedule, mocked_save, mocked_pipeline_id, *_): master_name = 'm' builder_name = 'b' build_number = 1 step_name = 's' test_name = 't' revision = 'r1000' isolate_target_name = 'target' try_job_id = 'try_job_id' mocked_pipeline_id.__get__ = mock.Mock(return_value='pipeline-id') mocked_schedule.return_value = try_job_id analysis = MasterFlakeAnalysis.Create(master_name, builder_name, build_number, step_name, test_name) analysis.Save() try_job = FlakeTryJob.Create(master_name, builder_name, step_name, test_name, revision) try_job.put() pipeline_input = RunFlakeTryJobParameters( analysis_urlsafe_key=analysis.key.urlsafe(), flake_cache_name=None, dimensions=ListOfBasestring(), revision=revision, isolate_target_name=isolate_target_name, urlsafe_try_job_key=try_job.key.urlsafe()) try_job_pipeline = RunFlakeTryJobPipeline(pipeline_input) try_job_pipeline.RunImpl(pipeline_input) mocked_schedule.assert_called_once_with(pipeline_input, 'pipeline-id') mocked_save.assert_called_once_with({'try_job_id': try_job_id})
def CreateNewSwarmingTaskRequestTemplate(runner_id, ref_task_id, ref_request, master_name, builder_name, step_name, tests, iterations): """Returns a SwarmingTaskRequest instance to run the given tests only. Args: ref_task_id (str): Id of the referred swarming task. ref_request (SwarmingTaskRequest): Request of the referred swarming task. master_name (str): The name of the main waterfall master for a build. builder_name (str): The name of the main waterfall builder for a build. step_name (str): The name of a failed step in the build. tests (list): A list of tests in the step that we want to rerun in task. iterations (int): Number of iterations each test should run. """ # Make a copy of the referred request and drop or overwrite some fields. new_request = copy.deepcopy(ref_request) new_request.name = 'findit/ref_task_id/%s/%s' % ( ref_task_id, time_util.GetUTCNow().strftime('%Y-%m-%d %H:%M:%S %f')) new_request.parent_task_id = '' new_request.user = '' _UpdateRequestWithPubSubCallback(new_request, runner_id) # To force a fresh re-run and ignore cached result of any equivalent run. new_request.properties.idempotent = False # Set the gtest_filter to run the given tests only. # Remove existing test filter first. new_request.properties.extra_args = ListOfBasestring.FromSerializable( [a for a in new_request.properties.extra_args if not _IsTestFilter(a)]) new_request.properties.extra_args.append( '--isolated-script-test-filter=%s' % '::'.join(tests)) new_request.properties.extra_args.append( '--isolated-script-test-repeat=%s' % iterations) new_request.properties.extra_args.append( '--isolated-script-test-launcher-retry-limit=0') # Also rerun disabled tests. Scenario: the test was disabled before Findit # runs any analysis. One possible case: # 1. A gtest became flaky on CQ, but Findit was not automatically # triggered to run any analysis because: # * the test is not flaky enough # * chromium-try-flakes has filed/updated too many bugs # 2. The test got disabled, but no culprit was identified. # 3. Some developer starts the investigation and requests Findit to # analyze the flaky test. # 4. Findit picks the latest Waterfall build of the matching configuration # for the CQ build in which the flaky test is found. # 5. In the picked Waterfall build, the test is already disabled. # # Note: test runner on Android ignores this flag because it is not supported # yet even though it exists. new_request.properties.extra_args.append( '--isolated-script-test-also-run-disabled-tests') # Remove the env setting for sharding. sharding_settings = ['GTEST_SHARD_INDEX', 'GTEST_TOTAL_SHARDS'] new_request.properties.env = [ e for e in new_request.properties.env if e['key'] not in sharding_settings ] # Reset tags for searching and monitoring. ref_name = swarming_util.GetTagValue(ref_request.tags, 'name') new_request.tags = ListOfBasestring() new_request.tags.append('ref_master:%s' % master_name) new_request.tags.append('ref_buildername:%s' % builder_name) new_request.tags.append('ref_stepname:%s' % step_name) new_request.tags.append('ref_name:%s' % ref_name) new_request.tags.extend( ['findit:1', 'project:Chromium', 'purpose:post-commit']) # Use a priority much lower than CQ for now (CQ's priority is 30). # Later we might use a higher priority -- a lower value here. # Note: the smaller value, the higher priority. swarming_settings = waterfall_config.GetSwarmingSettings() request_expiration_hours = swarming_settings.get( 'request_expiration_hours') new_request.priority = str( max(100, swarming_settings.get('default_request_priority'))) new_request.expiration_secs = str(request_expiration_hours * 60 * 60) return new_request