Get 5 days of test history when updating test owners, to avoid

accidentally removing tests that run rarely.
pull/6/head
Ryan Hitchman 2016-08-24 12:00:13 -07:00
parent b551bf1e5c
commit 23fb96b010
1 changed files with 9 additions and 5 deletions

View File

@ -33,8 +33,9 @@ SKIP_MAINTAINERS = {
'a-robinson', 'aronchick', 'bgrant0607-nocc', 'david-mcmahon',
'goltermann', 'sarahnovotny'}
def get_test_history():
url = time.strftime(GCS_URL_BASE + 'logs/%Y-%m-%d.json')
def get_test_history(days_ago):
url = time.strftime(GCS_URL_BASE + 'logs/%Y-%m-%d.json',
time.gmtime(time.time() - days_ago * 24 * 60 * 60))
resp = urllib2.urlopen(url)
content = resp.read()
if resp.headers.get('content-encoding') == 'gzip':
@ -97,9 +98,12 @@ def get_maintainers():
def main():
test_history = get_test_history()
test_names = sorted(set(map(normalize, test_history['test_names'])))
test_names.append('DEFAULT')
test_names = set()
for days_ago in range(4):
test_history = get_test_history(days_ago)
test_names.update(normalize(name) for name in test_history['test_names'])
test_names.add('DEFAULT')
test_names = sorted(test_names)
owners = load_owners(OWNERS_PATH)
outdated_tests = sorted(set(owners) - set(test_names))