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

Unified Diff: appengine/findit/waterfall/analyze_build_failure_pipeline.py

Issue 2158533002: [Findit] Use unittest.mock for testing and create a shared method to mock pipeline. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 4 years, 5 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/waterfall/analyze_build_failure_pipeline.py
diff --git a/appengine/findit/waterfall/analyze_build_failure_pipeline.py b/appengine/findit/waterfall/analyze_build_failure_pipeline.py
index c4268709a5613a01ff3f46e3de11e10646caa5be..b7916a785cfb48b3862bff8f4abc99cc339ce13b 100644
--- a/appengine/findit/waterfall/analyze_build_failure_pipeline.py
+++ b/appengine/findit/waterfall/analyze_build_failure_pipeline.py
@@ -37,15 +37,17 @@ class AnalyzeBuildFailurePipeline(BasePipeline):
Args:
was_aborted (bool): True if the pipeline was aborted, otherwise False.
"""
- if was_aborted:
- analysis = WfAnalysis.Get(
- self.master_name, self.builder_name, self.build_number)
- # Heuristic analysis could have already completed, while triggering the
- # try job kept failing and lead to the abortion.
- if analysis and not analysis.completed:
- analysis.status = analysis_status.ERROR
- analysis.result_status = None
- analysis.put()
+ if not was_aborted:
+ return
+
+ analysis = WfAnalysis.Get(
+ self.master_name, self.builder_name, self.build_number)
+ # Heuristic analysis could have already completed, while triggering the
+ # try job kept failing and lead to the abortion.
+ if not analysis.completed:
+ analysis.status = analysis_status.ERROR
+ analysis.result_status = None
+ analysis.put()
def finalized(self):
self._LogUnexpectedAborting(self.was_aborted)
« no previous file with comments | « appengine/findit/common/findit_testcase.py ('k') | appengine/findit/waterfall/build_failure_analysis_pipelines.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698