def testPerformPerfTry(self): self.SetCurrentUser('*****@*****.**') # Fake Rietveld auth info cfg = rietveld_service.RietveldConfig( id='default_rietveld_config', client_email='*****@*****.**', service_account_key='Fake Account Key', server_url='https://test-rietveld.appspot.com/') cfg.put() query_parameters = { 'bisect_bot': 'linux_perf_bisect', 'suite': 'dromaeo.jslibstylejquery', 'good_revision': '215806', 'bad_revision': '215828', 'step': 'perform-perf-try', 'rerun_option': '', } global _EXPECTED_CONFIG_DIFF global _TEST_EXPECTED_CONFIG_CONTENTS global _TEST_EXPECTED_BOT _EXPECTED_CONFIG_DIFF = _EXPECTED_PERF_CONFIG_DIFF _TEST_EXPECTED_CONFIG_CONTENTS = _PERF_CONFIG_CONTENTS _TEST_EXPECTED_BOT = 'linux_perf_bisect' response = self.testapp.post('/start_try_job', query_parameters) self.assertEqual(json.dumps({'issue_id': '33001'}), response.body)
def testPerformBuildbucketBisect(self): self.SetCurrentUser('*****@*****.**') # Fake Rietveld auth info cfg = rietveld_service.RietveldConfig( id='default_rietveld_config', client_email='*****@*****.**', service_account_key='Fake Account Key', server_url='https://test-rietveld.appspot.com') cfg.put() # Create bug. bug_data.Bug(id=12345).put() query_parameters = { 'bisect_bot': 'linux_perf_bisect', 'suite': 'dromaeo.jslibstylejquery', 'metric': 'jslib/jslib', 'good_revision': '215806', 'bad_revision': '215828', 'repeat_count': '20', 'max_time_minutes': '20', 'truncate_percent': '25', 'bug_id': 12345, 'use_archive': '', 'use_recipe': 'true', 'step': 'perform-bisect', } response = self.testapp.post('/start_try_job', query_parameters) response_dict = json.loads(response.body) self.assertEqual(response_dict['issue_id'], '1234567') self.assertIn('1234567', response_dict['issue_url']) job_entities = try_job.TryJob.query( try_job.TryJob.buildbucket_job_id == '1234567').fetch() self.assertEqual(1, len(job_entities)) self.assertTrue(job_entities[0].use_buildbucket)
def testPerformPerfTryStep_DeleteJobOnFailedBisect(self): self.SetCurrentUser('*****@*****.**') # Fake Rietveld auth info cfg = rietveld_service.RietveldConfig( id='default_rietveld_config', client_email='*****@*****.**', service_account_key='Fake Account Key', server_url='https://test-rietveld.appspot.com/') cfg.put() query_parameters = { 'bisect_bot': 'linux_perf_bisect', 'suite': 'dromaeo.jslibstylejquery', 'good_revision': '215806', 'bad_revision': '215828', 'rerun_option': '', } global _EXPECTED_CONFIG_DIFF global _TEST_EXPECTED_CONFIG_CONTENTS global _TEST_EXPECTED_BOT _EXPECTED_CONFIG_DIFF = _EXPECTED_PERF_CONFIG_DIFF _TEST_EXPECTED_CONFIG_CONTENTS = _PERF_CONFIG_CONTENTS _TEST_EXPECTED_BOT = 'linux_perf_bisect' query_parameters['step'] = 'perform-perf-try' self.testapp.post('/start_try_job', query_parameters) try_jobs = try_job.TryJob.query().fetch() self.assertEqual(0, len(try_jobs))
def _AddFakeRietveldConfig(self): """Sets up fake service account credentials for tests.""" rietveld_service.RietveldConfig( id='default_rietveld_config', client_email='*****@*****.**', service_account_key='Fake Account Key', server_url='https://test-rietveld.appspot.com', internal_server_url='https://test-rietveld.appspot.com').put()
def setUp(self): super(StartBisectTest, self).setUp() app = webapp2.WSGIApplication( [('/start_try_job', start_try_job.StartBisectHandler)]) self.testapp = webtest.TestApp(app) namespaced_stored_object.Set( can_bisect.BISECT_BOT_MAP_KEY, { 'ChromiumPerf': [ ('nexus4', 'android_nexus4_perf_bisect'), ('nexus7', 'android_nexus7_perf_bisect'), ('win8', 'win_8_perf_bisect'), ('xp', 'win_xp_perf_bisect'), ('android', 'android_nexus7_perf_bisect'), ('mac', 'mac_perf_bisect'), ('win', 'win_perf_bisect'), ('linux', 'linux_perf_bisect'), ('', 'linux_perf_bisect'), ], }) namespaced_stored_object.Set( start_try_job._BUILDER_TYPES_KEY, {'ChromiumPerf': 'perf', 'OtherMaster': 'foo'}) namespaced_stored_object.Set( start_try_job._BOT_BROWSER_MAP_KEY, [ ['android', 'android-chromium'], ['winx64', 'release_x64'], ['win_x64', 'release_x64'], ['', 'release'], ]) namespaced_stored_object.Set( start_try_job._TESTER_DIRECTOR_MAP_KEY, { 'ChromiumPerf': { 'linux_perf_tester': 'linux_perf_bisector', 'win64_nv_tester': 'linux_perf_bisector', } }) namespaced_stored_object.Set( start_try_job._MASTER_BUILDBUCKET_MAP_KEY, { 'ChromiumPerf': 'master.tryserver.chromium.perf' }) testing_common.SetSheriffDomains(['chromium.org']) # Add fake Rietveld auth info. rietveld_config = rietveld_service.RietveldConfig( id='default_rietveld_config', client_email='*****@*****.**', service_account_key='Fake Account Key', server_url='https://test-rietveld.appspot.com') rietveld_config.put()
def _AddRietveldConfig(self): """Adds a RietveldConfig entity to the datastore. This is used in order to get the Rietveld URL when requests are made to the handler in te tests below. In the real datastore, the RietveldConfig entity would contain credentials. """ rietveld_service.RietveldConfig( id='default_rietveld_config', client_email='*****@*****.**', service_account_key='Fake Account Key', server_url='https://test-rietveld.appspot.com', internal_server_url='https://test-rietveld.appspot.com').put()
def testPerformBisect(self): self.SetCurrentUser('*****@*****.**') # Fake Rietveld auth info cfg = rietveld_service.RietveldConfig( id='default_rietveld_config', client_email='*****@*****.**', service_account_key='Fake Account Key', server_url='https://test-rietveld.appspot.com') cfg.put() # Create bug. bug_data.Bug(id=12345).put() query_parameters = { 'bisect_bot': 'win_perf_bisect', 'suite': 'dromaeo.jslibstylejquery', 'metric': 'jslib/jslib', 'good_revision': '215806', 'bad_revision': '215828', 'repeat_count': '20', 'max_time_minutes': '20', 'truncate_percent': '25', 'bug_id': 12345, 'use_archive': '', 'step': 'perform-bisect', } global _EXPECTED_CONFIG_DIFF global _TEST_EXPECTED_BOT global _TEST_EXPECTED_CONFIG_CONTENTS _EXPECTED_CONFIG_DIFF = _EXPECTED_BISECT_CONFIG_DIFF _TEST_EXPECTED_BOT = 'win_perf_bisect' _TEST_EXPECTED_CONFIG_CONTENTS = _BISECT_CONFIG_CONTENTS response = self.testapp.post('/start_try_job', query_parameters) self.assertEqual( json.dumps({ 'issue_id': '33001', 'issue_url': 'https://test-rietveld.appspot.com/33001' }), response.body)