Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Unified Diff: scripts/slave/recipe_modules/test_results/resources/upload_test_results_unittest.py

Issue 2475973002: [recipe_modules/test_result] Support uploading full json results format for upload_test_results.py (Closed)
Patch Set: Address review comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « scripts/slave/recipe_modules/test_results/resources/upload_test_results.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/slave/recipe_modules/test_results/resources/upload_test_results_unittest.py
diff --git a/scripts/slave/recipe_modules/test_results/resources/upload_test_results_unittest.py b/scripts/slave/recipe_modules/test_results/resources/upload_test_results_unittest.py
index 1b62f377872d26b2fa14072da3cf7c92179f869a..b5f70ede0fb5f93cad31a7d6bcd56f73404d9bd4 100755
--- a/scripts/slave/recipe_modules/test_results/resources/upload_test_results_unittest.py
+++ b/scripts/slave/recipe_modules/test_results/resources/upload_test_results_unittest.py
@@ -79,7 +79,7 @@ class UploadTestResultsTest(unittest.TestCase):
results['Skipped.Test'][0].modifier)
@mock.patch('test_results_uploader.upload_test_results')
- def test_main(self, uploader_mock):
+ def test_main_gtest_json(self, uploader_mock):
contents = {
'per_iteration_data': [{
'Fake.Test': [
@@ -88,10 +88,10 @@ class UploadTestResultsTest(unittest.TestCase):
}],
}
result_directory = tempfile.mkdtemp()
- input_json_file_path = os.path.join(result_directory, 'results.json')
- with open(input_json_file_path, 'w') as f:
- json.dump(contents, f)
try:
+ input_json_file_path = os.path.join(result_directory, 'results.json')
+ with open(input_json_file_path, 'w') as f:
+ json.dump(contents, f)
upload_test_results.main([
'--test-type=foo',
'--input-json=%s' % input_json_file_path,
@@ -114,6 +114,54 @@ class UploadTestResultsTest(unittest.TestCase):
finally:
shutil.rmtree(result_directory)
+ @mock.patch('test_results_uploader.upload_test_results')
+ def test_main_full_results_json(self, uploader_mock):
+ contents = {
+ 'tests': {
+ 'mojom_tests': {
+ 'parse': {
+ 'ast_unittest': {
+ 'ASTTest': {
+ 'testNodeBase': {
+ 'expected': 'PASS',
+ 'actual': 'PASS'
+ }
+ }
+ }
+ }
+ }
+ },
+ 'interrupted': False,
+ 'path_delimiter': '.',
+ 'version': 3,
+ 'seconds_since_epoch': 1406662283.764424,
+ 'num_failures_by_type': {
+ 'FAIL': 0,
+ 'PASS': 1
+ }
+ }
+ result_directory = tempfile.mkdtemp()
+ try:
+ input_json_file_path = os.path.join(result_directory, 'results.json')
+ with open(input_json_file_path, 'w') as f:
+ json.dump(contents, f)
+ upload_test_results.main([
+ '--test-type=foo',
+ '--input-json=%s' % input_json_file_path,
+ '--results-directory=%s' % result_directory,
+ '--test-results-server=foo',
+ '--master-name=sauron',
+ ])
+ files = [(os.path.basename(input_json_file_path), input_json_file_path)]
+ uploader_mock.assert_called_with(
+ 'foo',
+ [('builder', 'DUMMY_BUILDER_NAME'),
+ ('testtype', 'foo'),
+ ('master', 'sauron')], files, 120)
+ finally:
+ shutil.rmtree(result_directory)
+
+
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « scripts/slave/recipe_modules/test_results/resources/upload_test_results.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698