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

Unified Diff: appengine/findit/handlers/test/build_failure_test.py

Issue 1912243003: [Findit] Add more tests to improve code coverage. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 4 years, 8 months 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
Index: appengine/findit/handlers/test/build_failure_test.py
diff --git a/appengine/findit/handlers/test/build_failure_test.py b/appengine/findit/handlers/test/build_failure_test.py
index 265779800e38d96a404797225b0fb2eaf9731125..6c664eff73e2239dad7840d722b92ebcbc69501f 100644
--- a/appengine/findit/handlers/test/build_failure_test.py
+++ b/appengine/findit/handlers/test/build_failure_test.py
@@ -692,3 +692,55 @@ class BuildFailureTest(wf_testcase.WaterfallTestCase):
build_failure.BuildFailure._PopulateHeuristicDataForCompileFailure(
analysis, data)
self.assertEqual(expected_data, data)
+
+ def testGetTryJobResultForCompileFailure(self):
+ analysis = WfAnalysis.Create('m', 'b', 123)
+ analysis.result = {
+ 'failures': [
+ {
+ 'step_name': 'compile',
+ 'first_failure': 122,
+ 'last_pass': 121,
+ 'suspected_cls': [],
+ },
+ {
+ 'step_name': 'steps',
+ },
+ ]
+ }
+ analysis.failure_result_map = {
+ 'compile': 'm/b/122',
+ }
+ analysis.status = analysis_status.COMPLETED
+ analysis.put()
+
+ try_job = WfTryJob.Create('m', 'b', 122)
+ try_job.status = analysis_status.COMPLETED
+ try_job.compile_results = [
+ {
+ 'url': 'build/url',
+ 'culprit': {
+ 'compile': {
+ 'revision': 'rev',
+ }
+ }
+ }
+ ]
+ try_job.put()
+
+ expected_try_job_result = {
+ 'status': 'completed',
+ 'url': 'build/url',
+ 'completed': True,
+ 'culprit': {
+ 'revision': 'rev',
+ },
+ 'failed': False,
+ }
+
+ build_url = buildbot.CreateBuildUrl('m', 'b', 123)
+ response = self.test_app.get('/build-failure',
+ params={'url': build_url, 'format': 'json'})
+
+ self.assertEquals(200, response.status_int)
+ self.assertEqual(expected_try_job_result, response.json_body['try_job'])
« no previous file with comments | « appengine/findit/handlers/build_failure.py ('k') | appengine/findit/waterfall/detect_first_failure_pipeline.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698