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._MASTER_BUILDBUCKET_MAP_KEY, {'ChromiumPerf': 'master.tryserver.chromium.perf'}) testing_common.SetSheriffDomains(['chromium.org'])
def setUp(self): super(PinpointNewRequestHandlerTest, self).setUp() app = webapp2.WSGIApplication([ (r'/pinpoint/new', pinpoint_request.PinpointNewRequestHandler) ]) self.testapp = webtest.TestApp(app) self.SetCurrentUser('*****@*****.**') namespaced_stored_object.Set( 'bot_dimensions_map', { 'mac': [{ 'key': 'foo', 'value': 'mac_dimensions' }], 'android-webview-nexus5x': [{ 'key': 'foo', 'value': 'android_dimensions' }] }) namespaced_stored_object.Set('repositories', { 'chromium': { 'some': 'params' }, 'v8': { 'more': 'params' } }) namespaced_stored_object.Set( 'bot_browser_map', [['android-webview', 'webview'], ['', 'release']])
def testStartNewBisectForBug_Pinpoint_Succeeds(self, mock_new): namespaced_stored_object.Set('bot_configurations', { 'linux-pinpoint': { 'dimensions': [{ 'key': 'foo', 'value': 'bar' }] }, }) namespaced_stored_object.Set('repositories', { 'chromium': { 'some': 'params' }, }) mock_new.return_value = {'jobId': 123, 'jobUrl': 'http://pinpoint/123'} testing_common.AddTests(['ChromiumPerf'], ['linux-pinpoint'], {'sunspider': { 'score': {} }}) test_key = utils.TestKey('ChromiumPerf/linux-pinpoint/sunspider/score') testing_common.AddRows( 'ChromiumPerf/linux-pinpoint/sunspider/score', { 11999: { 'a_default_rev': 'r_chromium', 'r_chromium': '9e29b5bcd08357155b2859f87227d50ed60cf857' }, 12500: { 'a_default_rev': 'r_chromium', 'r_chromium': 'fc34e5346446854637311ad7793a95d56e314042' } }) t = test_key.get() t.unescaped_story_name = 'score:foo' t.put() a = anomaly.Anomaly(bug_id=333, test=test_key, start_revision=12000, end_revision=12500, median_before_anomaly=100, median_after_anomaly=200).put() result = auto_bisect.StartNewBisectForBug(333) self.assertEqual({ 'issue_id': 123, 'issue_url': 'http://pinpoint/123' }, result) self.assertEqual('123', a.get().pinpoint_bisects[0]) self.assertEqual({ 'alert': a.urlsafe(), 'test_path': test_key.id() }, json.loads(mock_new.call_args[0][0]['tags'])) self.assertEqual('score:foo', mock_new.call_args[0][0]['story']) anomaly_entity = a.get() anomaly_magnitude = (anomaly_entity.median_after_anomaly - anomaly_entity.median_before_anomaly) self.assertEqual(anomaly_magnitude, mock_new.call_args[0][0]['comparison_magnitude'])
def setUp(self): super(NewTest, self).setUp() app = webapp2.WSGIApplication([ webapp2.Route(r'/api/new', new.New), ]) self.testapp = webtest.TestApp(app) self.SetCurrentUser('*****@*****.**', is_admin=True) namespaced_stored_object.Set( 'bot_configurations', { 'chromium-rel-mac11-pro': { 'browser': 'release', 'builder': 'Mac Builder', 'dimensions': {}, }, }) namespaced_stored_object.Set( 'repositories', { 'catapult': { 'repository_url': 'http://catapult' }, 'src': { 'repository_url': 'http://src' }, })
def setUp(self): super(GitilesTest, self).setUp() app = webapp2.WSGIApplication([ webapp2.Route(r'/api/gitiles', gitiles.Gitiles), ]) self.testapp = webtest.TestApp(app) self.SetCurrentUser('*****@*****.**') namespaced_stored_object.Set('repositories', { 'src': { 'repository_url': 'http://src' }, }) self.SetCurrentUser('*****@*****.**', is_admin=True) testing_common.SetIsInternalUser('*****@*****.**', True) namespaced_stored_object.Set( 'repositories', { 'src': { 'repository_url': 'http://src' }, 'internal_only': { 'repository_url': 'http://foo' }, })
def _AddRepository(url): """Add a repository URL to the database with the default name mapping. The default short repository name is the last part of the URL. Returns: The short repository name. Raises: AssertionError: The default name is already in the database. """ name = url.split('/')[-1] # Add to main repositories dict. repositories = namespaced_stored_object.Get(_REPOSITORIES_KEY) if name in repositories: raise AssertionError( "Attempted to add a repository that's already in the " 'Datastore: %s: %s' % (name, url)) repositories[name] = {'repository_url': url} namespaced_stored_object.Set(_REPOSITORIES_KEY, repositories) # Add to URL -> name mapping dict. urls_to_names = namespaced_stored_object.Get(_URLS_TO_NAMES_KEY) urls_to_names[url] = name namespaced_stored_object.Set(_URLS_TO_NAMES_KEY, urls_to_names) return name
def setUp(self): super(TelemetryQuestTest, self).setUp() self.SetCurrentUser('*****@*****.**', is_admin=True) namespaced_stored_object.Set('bot_dimensions_map', { 'chromium-rel-mac11-pro': {}, }) namespaced_stored_object.Set('bot_browser_map_2', { 'chromium-rel-mac11-pro': 'release', })
def setUp(self): super(_CommitTest, self).setUp() self.SetCurrentUser('*****@*****.**', is_admin=True) namespaced_stored_object.Set('repositories', { 'chromium': {'repository_url': _CHROMIUM_URL}, }) namespaced_stored_object.Set('repository_urls_to_names', { _CHROMIUM_URL: 'chromium', })
def setUp(self): super(DescribeTest, self).setUp() self.SetUpApp([(r'/api/describe', describe.DescribeHandler)]) self.SetCurrentClientIdOAuth(api_auth.OAUTH_CLIENT_ID_WHITELIST[0]) external_key = update_test_suite_descriptors.CacheKey( 'external', TEST_SUITE_NAME) namespaced_stored_object.SetExternal( external_key, { 'measurements': ['measurement'], 'bots': ['external:bot'], 'cases': ['case'], 'caseTags': {} }) testing_common.AddTests( ['external'], ['bot'], {'test_suite': { 'measurement': { 'case': {}, } }}) self.SetCurrentUserOAuth(testing_common.INTERNAL_USER) self.SetCurrentUser(testing_common.INTERNAL_USER.email()) testing_common.AddTests( ['internal'], ['bot'], {'test_suite': { 'measurement': { 'case': {}, } }}) t = utils.TestKey('internal/bot/test_suite').get() t.internal_only = True t.put() namespaced_stored_object.Set( external_key, { 'measurements': ['measurement'], 'bots': ['external:bot'], 'cases': ['case'], 'caseTags': {} }) internal_key = update_test_suite_descriptors.CacheKey( 'internal', TEST_SUITE_NAME) namespaced_stored_object.Set( internal_key, { 'measurements': ['measurement'], 'bots': ['internal:bot'], 'cases': ['case'], 'caseTags': {} })
def setUp(self): super(_ChangeTest, self).setUp() self.SetCurrentUser('*****@*****.**', is_admin=True) namespaced_stored_object.Set('repositories', { 'catapult': {'repository_url': _CATAPULT_URL}, 'chromium': {'repository_url': _CHROMIUM_URL}, 'another_repo': {'repository_url': 'https://another/url'}, }) namespaced_stored_object.Set('repository_urls_to_names', { _CATAPULT_URL: 'catapult', _CHROMIUM_URL: 'chromium', })
def testStartNewBisectForBut_BlacklistedMaster_SucceedsIfAlternative( self, _, mock_new): # Even if there are blacklisted masters, the bisect request should still # succeed if there's a non-blacklisted master. namespaced_stored_object.Set( 'file_bug_bisect_blacklist', {'ChromiumPerf': []}) namespaced_stored_object.Set('bot_configurations', { 'linux-pinpoint': { 'dimensions': [{'key': 'foo', 'value': 'bar'}] }, }) namespaced_stored_object.Set('repositories', { 'chromium': {'some': 'params'}, }) mock_new.return_value = {'jobId': 123, 'jobUrl': 'http://pinpoint/123'} testing_common.AddTests( ['ChromiumPerf'], ['linux-pinpoint'], {'sunspider': {'score': {}}}) testing_common.AddTests( ['ChromiumPerf2'], ['linux-pinpoint'], {'sunspider': {'score': {}}}) test_key = utils.TestKey('ChromiumPerf/linux-pinpoint/sunspider/score') test_key2 = utils.TestKey('ChromiumPerf2/linux-pinpoint/sunspider/score') rows = { 11999: { 'a_default_rev': 'r_chromium', 'r_chromium': '9e29b5bcd08357155b2859f87227d50ed60cf857' }, 12500: { 'a_default_rev': 'r_chromium', 'r_chromium': 'fc34e5346446854637311ad7793a95d56e314042' } } testing_common.AddRows('ChromiumPerf/linux-pinpoint/sunspider/score', rows) testing_common.AddRows('ChromiumPerf2/linux-pinpoint/sunspider/score', rows) anomaly.Anomaly( bug_id=333, test=test_key, start_revision=12000, end_revision=12500, median_before_anomaly=100, median_after_anomaly=200).put() a = anomaly.Anomaly( bug_id=333, test=test_key2, start_revision=12000, end_revision=12500, median_before_anomaly=100, median_after_anomaly=200).put() result = auto_bisect.StartNewBisectForBug(333) self.assertNotIn('error', result) self.assertEqual( {'alert': a.urlsafe(), 'test_path': test_key2.id()}, json.loads(mock_new.call_args[0][0]['tags']))
def setUp(self): super(ConfigTest, self).setUp() self.SetCurrentUser('*****@*****.**') namespaced_stored_object.Set('bot_configurations', { 'chromium-rel-mac11-pro': {}, }) self.SetCurrentUser('*****@*****.**', is_admin=True) testing_common.SetIsInternalUser('*****@*****.**', True) namespaced_stored_object.Set('bot_configurations', { 'internal-only-bot': {}, })
def testStartNewBisectForBug_DenylistedMaster_RaisesError(self): # Same setup as testStartNewBisectForBug_Pinpoint_Succeeds except for this # one setting. namespaced_stored_object.Set('file_bug_bisect_blacklist', {'ChromiumPerf': []}) namespaced_stored_object.Set('bot_configurations', { 'linux-pinpoint': { 'dimensions': [{ 'key': 'foo', 'value': 'bar' }] }, }) namespaced_stored_object.Set('repositories', { 'chromium': { 'some': 'params' }, }) testing_common.AddTests(['ChromiumPerf'], ['linux-pinpoint'], {'sunspider': { 'score': {} }}) test_key = utils.TestKey('ChromiumPerf/linux-pinpoint/sunspider/score') testing_common.AddRows( 'ChromiumPerf/linux-pinpoint/sunspider/score', { 11999: { 'a_default_rev': 'r_chromium', 'r_chromium': '9e29b5bcd08357155b2859f87227d50ed60cf857' }, 12500: { 'a_default_rev': 'r_chromium', 'r_chromium': 'fc34e5346446854637311ad7793a95d56e314042' } }) anomaly.Anomaly(bug_id=333, project_id='test_project', test=test_key, start_revision=12000, end_revision=12500, median_before_anomaly=100, median_after_anomaly=200).put() result = auto_bisect.StartNewBisectForBug(333, 'test_project') self.assertIn('error', result) self.assertIn( 'only available domains are excluded from automatic bisects', result['error'])
def testGuessBisectBot_FetchesNameFromBisectBotMap(self): namespaced_stored_object.Set( can_bisect.BISECT_BOT_MAP_KEY, {'OtherMaster': [('foo', 'super_foo_bisect_bot')]}) self.assertEqual( 'super_foo_bisect_bot', start_try_job.GuessBisectBot('OtherMaster', 'foo'))
def testGuessBisectBot_PlatformNotFound_UsesAvailableFallback(self): namespaced_stored_object.Set( can_bisect.BISECT_BOT_MAP_KEY, {'OtherMaster': [('foo', 'super_foo_bisect_bot')]}) self.assertEqual( 'super_foo_bisect_bot', start_try_job.GuessBisectBot('OtherMaster', 'bar'))
def testAliases(self): namespaced_stored_object.Set( bot_configurations.BOT_CONFIGURATIONS_KEY, { 'a-alias0': { 'alias': 'a-canonical', }, 'a-alias1': { 'alias': 'a-canonical', }, 'a-canonical': {}, 'b-canonical': {}, 'c-canonical': {}, 'c-alias0': { 'alias': 'c-canonical', }, }) actual = bot_configurations.GetAliasesAsync('a-canonical').get_result() self.assertEqual({'a-canonical', 'a-alias0', 'a-alias1'}, actual) actual = bot_configurations.GetAliasesAsync('a-alias0').get_result() self.assertEqual({'a-canonical', 'a-alias0', 'a-alias1'}, actual) actual = bot_configurations.GetAliasesAsync('a-alias1').get_result() self.assertEqual({'a-canonical', 'a-alias0', 'a-alias1'}, actual) actual = bot_configurations.GetAliasesAsync('b-canonical').get_result() self.assertEqual({'b-canonical'}, actual) actual = bot_configurations.GetAliasesAsync('c-canonical').get_result() self.assertEqual({'c-canonical', 'c-alias0'}, actual) actual = bot_configurations.GetAliasesAsync('c-alias0').get_result() self.assertEqual({'c-canonical', 'c-alias0'}, actual) actual = bot_configurations.GetAliasesAsync('unknown').get_result() self.assertEqual({'unknown'}, actual)
def testGuessBisectBot_TreatsMasterNameAsPrefix(self): namespaced_stored_object.Set( can_bisect.BISECT_BOT_MAP_KEY, {'OtherMaster': [('foo', 'super_foo_bisect_bot')]}) self.assertEqual( 'super_foo_bisect_bot', start_try_job.GuessBisectBot('OtherMasterFyi', 'foo'))
def testGet_WithFinish_CreatesBugSingleRevDifferentMasterOwner(self): # When a POST request is sent with keys specified and with the finish # parameter given, an issue will be created using the issue tracker # API, and the anomalies will be updated, and a response page will # be sent which indicates success. namespaced_stored_object.Set( 'repositories', { "chromium": { "repository_url": "https://chromium.googlesource.com/chromium/src" } }) self._issue_tracker_service._bug_id_counter = 277761 response = self._PostSampleBug(is_single_rev=True, master='Foo') # The response page should have a bug number. self.assertIn('277761', response.body) # Three HTTP requests are made when filing a bug with owner; test third # request for owner hame. comment = self._issue_tracker_service.add_comment_args[1] self.assertNotIn( 'Assigning to [email protected] because this is the only CL in range', comment) self.assertNotIn('My first commit', comment)
def setUp(self): super(DescriptorTest, self).setUp() stored_object.Set(descriptor.PARTIAL_TEST_SUITES_KEY, [ 'TEST_PARTIAL_TEST_SUITE', ]) stored_object.Set(descriptor.COMPOSITE_TEST_SUITES_KEY, [ 'TEST_PARTIAL_TEST_SUITE:COMPOSITE', 'TEST_PARTIAL_TEST_SUITE:two_two', ]) stored_object.Set(descriptor.GROUPABLE_TEST_SUITE_PREFIXES_KEY, [ 'TEST_GROUPABLE%', 'v8.', ]) stored_object.Set(descriptor.POLY_MEASUREMENT_TEST_SUITES_KEY, [ 'resource_sizes:foo', 'sizes', 'polymeasurement', 'TEST_PARTIAL_TEST_SUITE:two_two', ]) stored_object.Set(descriptor.TWO_TWO_TEST_SUITES_KEY, [ 'TEST_PARTIAL_TEST_SUITE:two_two', ]) namespaced_stored_object.Set(bot_configurations.BOT_CONFIGURATIONS_KEY, { 'a': { 'alias': 'b', }, 'b': {}, 'c': { 'alias': 'b', }, }) descriptor.Descriptor.ResetMemoizedConfigurationForTesting()
def testGet_WithFinish_CreatesBugSingleRevAutorollOwner(self): # When a POST request is sent with keys specified and with the finish # parameter given, an issue will be created using the issue tracker # API, and the anomalies will be updated, and a response page will # be sent which indicates success. namespaced_stored_object.Set( 'repositories', { "chromium": { "repository_url": "https://chromium.googlesource.com/chromium/src" } }) MockIssueTrackerService.bug_id = 277761 response = self._PostSampleBug(is_single_rev=True) # The response page should have a bug number. self.assertIn('277761', response.body) # Two HTTP requests are made when filing a bug; only test 2nd request. comment = MockIssueTrackerService.add_comment_args[1] self.assertIn( 'https://chromeperf.appspot.com/group_report?bug_id=277761', comment) self.assertIn('https://chromeperf.appspot.com/group_report?sid=', comment) self.assertIn( '\n\n\nBot(s) for this bug\'s original alert(s):\n\nlinux', comment)
def testGet_WithNamespacedKey_ShowsPageWithBothVersions(self): namespaced_stored_object.Set('foo', 'XXXYYY') namespaced_stored_object.SetExternal('foo', 'XXXinternalYYY') response = self.testapp.get('/edit_site_config?key=foo') self.assertEqual(1, len(response.html('form'))) self.assertIn('XXXYYY', response.body) self.assertIn('XXXinternalYYY', response.body)
def setUp(self): super(_NewTest, self).setUp() app = webapp2.WSGIApplication([ webapp2.Route(r'/api/new', new.New), ]) self.testapp = webtest.TestApp(app) self.SetCurrentUser('*****@*****.**', is_admin=True) namespaced_stored_object.Set('bot_configurations', { 'chromium-rel-mac11-pro': _CONFIGURATION_ARGUMENTS }) namespaced_stored_object.Set('repositories', { 'src': {'repository_url': 'http://src'}, })
def setUp(self): super(DepTest, self).setUp() self.SetCurrentUser('*****@*****.**', is_admin=True) namespaced_stored_object.Set('repositories', { 'src': {'repository_url': _SRC_URL}, })
def testStartNewBisectForBug_Pinpoint_Succeeds(self, mock_guess): namespaced_stored_object.Set('bot_configurations', { 'linux-pinpoint': { 'dimensions': [{ 'key': 'foo', 'value': 'bar' }] }, }) namespaced_stored_object.Set('repositories', { 'chromium': { 'some': 'params' }, }) testing_common.AddTests(['ChromiumPerf'], ['linux-pinpoint'], {'sunspider': { 'score': {} }}) test_key = utils.TestKey('ChromiumPerf/linux-pinpoint/sunspider/score') testing_common.AddRows( 'ChromiumPerf/linux-pinpoint/sunspider/score', { 11999: { 'a_default_rev': 'r_chromium', 'r_chromium': '9e29b5bcd08357155b2859f87227d50ed60cf857' }, 12500: { 'a_default_rev': 'r_chromium', 'r_chromium': 'fc34e5346446854637311ad7793a95d56e314042' } }) a = anomaly.Anomaly(bug_id=333, test=test_key, start_revision=12000, end_revision=12500, median_before_anomaly=100, median_after_anomaly=200).put() result = auto_bisect.StartNewBisectForBug(333) self.assertEqual({ 'issue_id': 123, 'issue_url': 'http://pinpoint/123' }, result) mock_guess.assert_called_once_with( 'ChromiumPerf/linux-pinpoint/sunspider/score') self.assertEqual('123', a.get().pinpoint_bisects[0])
def setUp(self): super(FindIsolateQuestTest, self).setUp() self.SetCurrentUser('*****@*****.**', is_admin=True) namespaced_stored_object.Set('bot_configurations', { 'chromium-rel-mac11-pro': { 'builder': 'Mac Builder', }, })
def setUp(self): super(ChangeTest, self).setUp() self.SetCurrentUser('*****@*****.**', is_admin=True) namespaced_stored_object.Set('repositories', { 'catapult': {'repository_url': _CATAPULT_URL}, 'chromium': {'repository_url': _CHROMIUM_URL}, })
def _AddRepository(url): name = url.split('/')[-1] # Add to main repositories dict. repositories = namespaced_stored_object.Get(_REPOSITORIES_KEY) if name in repositories: raise AssertionError( "Attempted to add a repository that's already in the " 'Datastore: %s: %s' % (name, url)) repositories[name] = {'repository_url': url} namespaced_stored_object.Set(_REPOSITORIES_KEY, repositories) # Add to URL -> name mapping dict. urls_to_names = namespaced_stored_object.Get(_URLS_TO_NAMES_KEY) urls_to_names[url] = name namespaced_stored_object.Set(_URLS_TO_NAMES_KEY, urls_to_names) return name
def setUp(self): super(PinpointNewBisectComparisonMagnitude, self).setUp() self.SetCurrentUser('*****@*****.**') namespaced_stored_object.Set('repositories', { 'chromium': {'some': 'params'}, 'v8': {'more': 'params'} })
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._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 setUp(self): super(ConfigTest, self).setUp() app = webapp2.WSGIApplication([ webapp2.Route(r'/api/config', config.Config), ]) self.testapp = webtest.TestApp(app) self.SetCurrentUser('*****@*****.**') namespaced_stored_object.Set('bot_configurations', { 'chromium-rel-mac11-pro': {}, }) self.SetCurrentUser('*****@*****.**', is_admin=True) testing_common.SetIsInternalUser('*****@*****.**', True) namespaced_stored_object.Set('bot_configurations', { 'internal-only-bot': {}, })