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

Unified Diff: appengine/findit/waterfall/test/suspected_cl_util_test.py

Issue 2439553002: [Findit] Reduce redundant ndb reads by querying necessary entities ahead of time and share them amo… (Closed)
Patch Set: rebase Created 4 years, 2 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
« no previous file with comments | « appengine/findit/waterfall/suspected_cl_util.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/waterfall/test/suspected_cl_util_test.py
diff --git a/appengine/findit/waterfall/test/suspected_cl_util_test.py b/appengine/findit/waterfall/test/suspected_cl_util_test.py
index fead721f187ae22feeccb995c8541be272cdc635..bac9b16d12675b7660d99e4310fdc48939513b8e 100644
--- a/appengine/findit/waterfall/test/suspected_cl_util_test.py
+++ b/appengine/findit/waterfall/test/suspected_cl_util_test.py
@@ -404,3 +404,125 @@ class SuspectedCLUtilTest(wf_testcase.WaterfallTestCase):
}
self.assertIsNone(suspected_cl_util.GetSuspectedCLConfidenceScore(
self.cl_confidences, build))
+
+ def testGetSuspectedCLConfidenceScoreAndApproachNone(self):
+ confidence, approach = (
+ suspected_cl_util.GetSuspectedCLConfidenceScoreAndApproach(
+ self.cl_confidences, None, None))
+ self.assertIsNone(confidence)
+ self.assertIsNone(approach)
+
+ def testGetSuspectedCLConfidenceScoreAndApproachUseFirstBuild(self):
+ build = {
+ 'failure_type': failure_type.COMPILE,
+ 'failures': None,
+ 'status': suspected_cl_status.CORRECT,
+ 'approaches': [analysis_approach_type.TRY_JOB],
+ 'top_score': 5
+ }
+
+ first_build = {
+ 'failure_type': failure_type.COMPILE,
+ 'failures': None,
+ 'status': suspected_cl_status.CORRECT,
+ 'approaches': [analysis_approach_type.TRY_JOB,
+ analysis_approach_type.HEURISTIC],
+ 'top_score': 5
+ }
+
+ confidence, approach = (
+ suspected_cl_util.GetSuspectedCLConfidenceScoreAndApproach(
+ self.cl_confidences, build, first_build))
+
+ self.assertEqual(
+ suspected_cl_util._RoundConfidentToInteger(
+ self.cl_confidences.compile_heuristic_try_job.confidence),
+ confidence)
+ self.assertEqual(
+ analysis_approach_type.TRY_JOB, approach)
+
+ def testGetSuspectedCLConfidenceScoreAndApproachUseNewStep(self):
+ build = {
+ 'failure_type': failure_type.TEST,
+ 'failures': {'a': [], 'b': []},
+ 'status': suspected_cl_status.CORRECT,
+ 'approaches': [analysis_approach_type.HEURISTIC],
+ 'top_score': 5
+ }
+
+ first_build = {
+ 'failure_type': failure_type.TEST,
+ 'failures': {'a': ['t1']},
+ 'status': suspected_cl_status.CORRECT,
+ 'approaches': [analysis_approach_type.TRY_JOB,
+ analysis_approach_type.HEURISTIC],
+ 'top_score': 5
+ }
+
+ confidence, approach = (
+ suspected_cl_util.GetSuspectedCLConfidenceScoreAndApproach(
+ self.cl_confidences, build, first_build))
+
+ self.assertEqual(
+ suspected_cl_util._RoundConfidentToInteger(
+ self.cl_confidences.test_heuristic[1].confidence),
+ confidence)
+ self.assertEqual(
+ analysis_approach_type.HEURISTIC, approach)
+
+ def testGetSuspectedCLConfidenceScoreAndApproachUseNewTest(self):
+ build = {
+ 'failure_type': failure_type.TEST,
+ 'failures': {'a': ['t1', 't2']},
+ 'status': suspected_cl_status.CORRECT,
+ 'approaches': [analysis_approach_type.HEURISTIC],
+ 'top_score': 5
+ }
+
+ first_build = {
+ 'failure_type': failure_type.TEST,
+ 'failures': {'a': ['t1']},
+ 'status': suspected_cl_status.CORRECT,
+ 'approaches': [analysis_approach_type.TRY_JOB,
+ analysis_approach_type.HEURISTIC],
+ 'top_score': 5
+ }
+
+ confidence, approach = (
+ suspected_cl_util.GetSuspectedCLConfidenceScoreAndApproach(
+ self.cl_confidences, build, first_build))
+
+ self.assertEqual(
+ suspected_cl_util._RoundConfidentToInteger(
+ self.cl_confidences.test_heuristic[1].confidence),
+ confidence)
+ self.assertEqual(
+ analysis_approach_type.HEURISTIC, approach)
+
+ def testGetSuspectedCLConfidenceScoreAndApproachUseLessTest(self):
+ build = {
+ 'failure_type': failure_type.TEST,
+ 'failures': {'a': ['t1']},
+ 'status': suspected_cl_status.CORRECT,
+ 'approaches': [analysis_approach_type.HEURISTIC],
+ 'top_score': 5
+ }
+
+ first_build = {
+ 'failure_type': failure_type.TEST,
+ 'failures': {'a': ['t1', 't2']},
+ 'status': suspected_cl_status.CORRECT,
+ 'approaches': [analysis_approach_type.TRY_JOB,
+ analysis_approach_type.HEURISTIC],
+ 'top_score': 5
+ }
+
+ confidence, approach = (
+ suspected_cl_util.GetSuspectedCLConfidenceScoreAndApproach(
+ self.cl_confidences, build, first_build))
+
+ self.assertEqual(
+ suspected_cl_util._RoundConfidentToInteger(
+ self.cl_confidences.test_heuristic_try_job.confidence), confidence)
+ self.assertEqual(
+ analysis_approach_type.TRY_JOB, approach)
« no previous file with comments | « appengine/findit/waterfall/suspected_cl_util.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698