summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchrisphan <chrisphan@chromium.org>2016-03-18 16:06:44 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-18 23:11:02 +0000
commit58e66c8324eead53cf85bdb6bd333f5d4d6c254e (patch)
tree39d2acbf778bfbd954cf543cf8988b1ca22d8294
parent839003fd184e1af390996cc6357c62ba5890b714 (diff)
downloadchromium_src-58e66c8324eead53cf85bdb6bd333f5d4d6c254e.zip
chromium_src-58e66c8324eead53cf85bdb6bd333f5d4d6c254e.tar.gz
chromium_src-58e66c8324eead53cf85bdb6bd333f5d4d6c254e.tar.bz2
Fix legacy bisect making post request to dashboard.
Dashboard expects a urlencoded format. BUG=477448 Review URL: https://codereview.chromium.org/1818553003 Cr-Commit-Position: refs/heads/master@{#382123}
-rwxr-xr-xtools/auto_bisect/bisect_perf_regression.py7
-rw-r--r--tools/auto_bisect/bisect_perf_regression_test.py6
2 files changed, 9 insertions, 4 deletions
diff --git a/tools/auto_bisect/bisect_perf_regression.py b/tools/auto_bisect/bisect_perf_regression.py
index d1f28c4..2164dae 100755
--- a/tools/auto_bisect/bisect_perf_regression.py
+++ b/tools/auto_bisect/bisect_perf_regression.py
@@ -54,6 +54,7 @@ import shutil
import StringIO
import sys
import time
+import urllib
import urllib2
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..',
@@ -2151,11 +2152,11 @@ class BisectPerformanceMetrics(object):
results = bisect_results_json.Get(
bisect_results, self.opts, self.depot_registry)
- data = {'data': results}
+ results_json = json.dumps(results)
+ data = urllib.urlencode({'data': results_json})
request = urllib2.Request(PERF_DASH_RESULTS_URL)
- request.add_header('Content-Type', 'application/json')
try:
- urllib2.urlopen(request, json.dumps(data))
+ urllib2.urlopen(request, data)
except urllib2.URLError as e:
print 'Failed to post bisect results. Error: %s.' % e
bisect_utils.OutputAnnotationStepWarning()
diff --git a/tools/auto_bisect/bisect_perf_regression_test.py b/tools/auto_bisect/bisect_perf_regression_test.py
index 22ad7c3..30c9b24 100644
--- a/tools/auto_bisect/bisect_perf_regression_test.py
+++ b/tools/auto_bisect/bisect_perf_regression_test.py
@@ -2,10 +2,12 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import json
import os
import re
import shutil
import sys
+import urlparse
import unittest
SRC = os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir)
@@ -376,7 +378,9 @@ class BisectPerfRegressionTest(unittest.TestCase):
call_args = _GetMockCallArg(mock_urlopen, 0)
self.assertIsNotNone(call_args)
- self.assertIn('"try_job_id": 1234', call_args[1])
+ called_data = urlparse.parse_qs(call_args[1])
+ results_data = json.loads(called_data['data'][0])
+ self.assertEqual(1234, results_data['try_job_id'])
def _CheckAbortsEarly(self, results, **extra_opts):
"""Returns True if the bisect job would abort early."""