Commit adb5a33f authored by ojan@chromium.org's avatar ojan@chromium.org

Take two at fixing android bots still using testlistjson.

testlistjson should go down the same codepath as other content
that serves up the actual file content so that it gets
the right master name.

TBR since this is causing 500s on the live server.

TBR=szager@chromium.org

Revert "Get rid of testlistjson query parameter."

This reverts r180005. Turns out that the android JSONResultsGenerator
really does depend on testlistjson not having the results and times. :(

TBR=szager@chromium.org

Review URL: https://codereview.chromium.org/467453002

git-svn-id: svn://svn.chromium.org/blink/trunk@180011 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 894c0e2c
......@@ -155,21 +155,6 @@ class GetFile(webapp2.RequestHandler):
file.load_data()
return file.data, file.date
def _get_test_list_json(self, master, builder, test_type, build_number):
"""Return json file with test name list only, do not include test
results and other non-test-data .
Args:
builder: builder name.
test_type: type of test results.
"""
json, date = self._get_file_content(master, builder, test_type, build_number, "results.json")
if not json:
return None
return JsonResults.get_test_list(builder, json), date
def _serve_json(self, json, modified_date):
if json:
if "If-Modified-Since" in self.request.headers:
......@@ -205,8 +190,6 @@ class GetFile(webapp2.RequestHandler):
if key:
json, date = self._get_file_content_from_key(key)
elif test_list_json:
json, date = self._get_test_list_json(master, builder, test_type, build_number)
elif num_files or not master or not builder or not test_type or (not build_number and not JsonResults.is_aggregate_file(name)) or not name:
limit = int(num_files) if num_files else 100
self._get_file_list(master, builder, test_type, build_number, name, before, limit, callback_name)
......@@ -219,10 +202,14 @@ class GetFile(webapp2.RequestHandler):
if not master_data:
self.error(404)
return
json, date = self._get_file_content(master_data['url_name'], builder, test_type, build_number, name)
if json is None:
json, date = self._get_file_content(master_data['name'], builder, test_type, build_number, name)
if test_list_json:
json = JsonResults.get_test_list(builder, json)
if json:
json = _replace_jsonp_callback(json, callback_name)
......
......@@ -70,7 +70,7 @@ class TestFileHandlerTest(unittest.TestCase):
'tests': {
'Test1.testproc1': {
'expected': 'PASS',
'actual': 'PASS',
'actual': 'FAIL',
'time': 1,
}
},
......@@ -96,17 +96,26 @@ class TestFileHandlerTest(unittest.TestCase):
response = self.testapp.post('/testfile/upload', params=params, upload_files=upload_files)
self.assertEqual(response.status_int, 200)
# test aggregated results.json got generated
params = collections.OrderedDict([
(testfilehandler.PARAM_BUILDER, builder),
(testfilehandler.PARAM_MASTER, master['url_name']),
(testfilehandler.PARAM_TEST_TYPE, test_type),
(testfilehandler.PARAM_BUILD_NUMBER, '123'),
(testfilehandler.PARAM_NAME, 'full_results.json')
(testfilehandler.PARAM_NAME, 'results.json')
])
response = self.testapp.get('/testfile', params=params)
self.assertEqual(response.status_int, 200)
response_json = json.loads(response.normal_body)
self.assertEqual(response_json['chromium_revision'], '67890')
self.assertEqual(response_json[builder]['tests']['Test1.testproc1'],
{'results': [[1, 'Q']], 'times': [[1, 1]]})
# test testlistjson=1
params[testfilehandler.PARAM_TEST_LIST_JSON] = '1'
response = self.testapp.get('/testfile', params=params)
self.assertEqual(response.status_int, 200)
response_json = json.loads(response.normal_body)
self.assertEqual(response_json[builder]['tests']['Test1.testproc1'], {})
def test_deprecated_master_name(self):
"""Verify that a file uploaded with a deprecated master name
......
......@@ -33,7 +33,7 @@ except ImportError:
print "ERROR: Add the TestResultServer, google_appengine and yaml/lib directories to your PYTHONPATH"
raise
import master_config
from handlers import master_config
import json
import logging
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment