def test_master_name_from_url(self): tests = [('https://build.chromium.org/p/chromium.mac', 'chromium.mac'), ('https://build.chromium.org/p/tryserver.blink', 'tryserver.blink')] for master_url, master_name in tests: self.assertEquals(buildbot.master_name_from_url(master_url), master_name)
def test_master_name_from_url(self): tests = [ ('https://build.chromium.org/p/chromium.mac', 'chromium.mac'), ('https://build.chromium.org/p/tryserver.blink', 'tryserver.blink') ] for master_url, master_name in tests: self.assertEquals(buildbot.master_name_from_url(master_url), master_name)
def reasons_for_failure(cache, step, build, builder_name, master_url): master_name = buildbot.master_name_from_url(master_url) cache_key = os.path.join(master_name, builder_name, str(build['number']), '%s.json' % step['name']) if cache.has(cache_key): return cache.get(cache_key) splitter = reasons_splitter.splitter_for_step(step) if not splitter: return None reasons = splitter.split_step(step, build, builder_name, master_url) cache.set(cache_key, reasons) return reasons
def tree_for_master(master_url, gatekeeper_trees_config): """Get the name of the tree for a given master url, or the master's name.""" # TODO(phajdan.jr): Read config from gatekeeper.json instead and remove hack. # See https://code.google.com/p/chromium/issues/detail?id=529801 . if 'chromium.webkit' in master_url: return 'blink' for tree_name, tree_config in gatekeeper_trees_config.iteritems(): if master_url in tree_config['masters']: return tree_name return master_name_from_url(master_url)
def request_test_results_json(step, build, builder_name, master_url): test_type = step['name'] params = { 'name': 'full_results.json', 'master': buildbot.master_name_from_url(master_url), 'builder': builder_name, 'buildnumber': build['number'], 'testtype': test_type, } base_url = 'https://test-results.appspot.com/testfile' response = requests.get(base_url, params=params) if response.status_code != 200: logging.warn( 'test-results missing %s %s %s %s.', master_url, builder_name, build['number'], step['name']) return None return flatten_test_results(response.json()['tests'])
def alert_for_stale_master_data(master_url, master_json): # pragma: no cover # We only have a created timestamp when we get the master_json from # Chrome Build Extract. if 'created_timestamp' not in master_json: return None update_time_from_master = int(master_json['created_timestamp']) time_since_update = int(time.time()) - update_time_from_master if time_since_update < STALE_MASTER_ALERT_THRESHOLD: if time_since_update < 0: logging.critical( 'Master data timestamp (%d) is newer than current time ' '(%d). Delta %d.' % (update_time_from_master, int(time.time()), time_since_update)) return None return { 'last_update_time': update_time_from_master, 'master_url': master_url, 'master_name': buildbot.master_name_from_url(master_url), }
def request_test_results_json(step, build, builder_name, master_url): test_type = step['name'] # TODO(ojan): Stop having webkit_tests masquerade as layout-tests # in test-results.appspot. if test_type == 'webkit_tests': test_type = 'layout-tests' params = { 'name': 'full_results.json', 'master': buildbot.master_name_from_url(master_url), 'builder': builder_name, 'buildnumber': build['number'], 'testtype': test_type, } base_url = 'https://test-results.appspot.com/testfile' response = requests.get(base_url, params=params) if response.status_code != 200: logging.warn('test-results missing %s %s %s %s.', master_url, builder_name, build['number'], step['name']) return None return flatten_test_results(response.json()['tests'])
def tree_for_master(master_url, gatekeeper_trees_config): """Get the name of the tree for a given master url, or the master's name.""" for tree_name, tree_config in gatekeeper_trees_config.iteritems(): if master_url in tree_config['masters']: return tree_name return master_name_from_url(master_url)