@Test @UseDataProvider("dataProviderGetAggregatedJudgment") public void test_getAggregatedJudgment( Double finalCanaryScore, Double marginalThreshold, Double passThreshold, boolean expected) { GenerateCanaryAnalysisResultTask.AggregatedJudgement aggregatedJudgement = task.getAggregatedJudgment(finalCanaryScore, marginalThreshold, passThreshold); assertEquals(expected, aggregatedJudgement.isDidPassThresholds()); }
protected AggregatedJudgement getAggregatedJudgment( Double finalCanaryScore, Double marginalThreshold, Double passThreshold) { boolean didPassThresholds; String msg; if (marginalThreshold == null && passThreshold == null) { didPassThresholds = true; msg = "No score thresholds were specified."; } else if (marginalThreshold != null && finalCanaryScore <= marginalThreshold) { didPassThresholds = false; msg = String.format( "Final canary score %s is not above the marginal score threshold.", finalCanaryScore); } else if (passThreshold == null) { didPassThresholds = true; msg = "No pass score threshold was specified."; } else if (finalCanaryScore < passThreshold) { didPassThresholds = false; msg = String.format( "Final canary score %s is below the pass score threshold.", finalCanaryScore); } else { didPassThresholds = true; msg = String.format( "Final canary score %s met or exceeded the pass score threshold.", finalCanaryScore); } return new AggregatedJudgement(didPassThresholds, msg); }
GenerateCanaryAnalysisResultTask implements Task { protected AggregatedJudgement getAggregatedJudgment( Double finalCanaryScore, Double marginalThreshold, Double passThreshold) { boolean didPassThresholds; String msg; if (marginalThreshold == null && passThreshold == null) { didPassThresholds = true; msg = "No score thresholds were specified."; } else if (marginalThreshold != null && finalCanaryScore <= marginalThreshold) { didPassThresholds = false; msg = String.format( "Final canary score %s is not above the marginal score threshold.", finalCanaryScore); } else if (passThreshold == null) { didPassThresholds = true; msg = "No pass score threshold was specified."; } else if (finalCanaryScore < passThreshold) { didPassThresholds = false; msg = String.format( "Final canary score %s is below the pass score threshold.", finalCanaryScore); } else { didPassThresholds = true; msg = String.format( "Final canary score %s met or exceeded the pass score threshold.", finalCanaryScore); } return new AggregatedJudgement(didPassThresholds, msg); } }
GenerateCanaryAnalysisResultTask implements Task { protected AggregatedJudgement getAggregatedJudgment( Double finalCanaryScore, Double marginalThreshold, Double passThreshold) { boolean didPassThresholds; String msg; if (marginalThreshold == null && passThreshold == null) { didPassThresholds = true; msg = "No score thresholds were specified."; } else if (marginalThreshold != null && finalCanaryScore <= marginalThreshold) { didPassThresholds = false; msg = String.format( "Final canary score %s is not above the marginal score threshold.", finalCanaryScore); } else if (passThreshold == null) { didPassThresholds = true; msg = "No pass score threshold was specified."; } else if (finalCanaryScore < passThreshold) { didPassThresholds = false; msg = String.format( "Final canary score %s is below the pass score threshold.", finalCanaryScore); } else { didPassThresholds = true; msg = String.format( "Final canary score %s met or exceeded the pass score threshold.", finalCanaryScore); } return new AggregatedJudgement(didPassThresholds, msg); } @Autowired  GenerateCanaryAnalysisResultTask(ObjectMapper kayentaObjectMapper); }
GenerateCanaryAnalysisResultTask implements Task { protected AggregatedJudgement getAggregatedJudgment( Double finalCanaryScore, Double marginalThreshold, Double passThreshold) { boolean didPassThresholds; String msg; if (marginalThreshold == null && passThreshold == null) { didPassThresholds = true; msg = "No score thresholds were specified."; } else if (marginalThreshold != null && finalCanaryScore <= marginalThreshold) { didPassThresholds = false; msg = String.format( "Final canary score %s is not above the marginal score threshold.", finalCanaryScore); } else if (passThreshold == null) { didPassThresholds = true; msg = "No pass score threshold was specified."; } else if (finalCanaryScore < passThreshold) { didPassThresholds = false; msg = String.format( "Final canary score %s is below the pass score threshold.", finalCanaryScore); } else { didPassThresholds = true; msg = String.format( "Final canary score %s met or exceeded the pass score threshold.", finalCanaryScore); } return new AggregatedJudgement(didPassThresholds, msg); } @Autowired  GenerateCanaryAnalysisResultTask(ObjectMapper kayentaObjectMapper); @Nonnull @Override TaskResult execute(@Nonnull StageExecution stage); }
GenerateCanaryAnalysisResultTask implements Task { protected AggregatedJudgement getAggregatedJudgment( Double finalCanaryScore, Double marginalThreshold, Double passThreshold) { boolean didPassThresholds; String msg; if (marginalThreshold == null && passThreshold == null) { didPassThresholds = true; msg = "No score thresholds were specified."; } else if (marginalThreshold != null && finalCanaryScore <= marginalThreshold) { didPassThresholds = false; msg = String.format( "Final canary score %s is not above the marginal score threshold.", finalCanaryScore); } else if (passThreshold == null) { didPassThresholds = true; msg = "No pass score threshold was specified."; } else if (finalCanaryScore < passThreshold) { didPassThresholds = false; msg = String.format( "Final canary score %s is below the pass score threshold.", finalCanaryScore); } else { didPassThresholds = true; msg = String.format( "Final canary score %s met or exceeded the pass score threshold.", finalCanaryScore); } return new AggregatedJudgement(didPassThresholds, msg); } @Autowired  GenerateCanaryAnalysisResultTask(ObjectMapper kayentaObjectMapper); @Nonnull @Override TaskResult execute(@Nonnull StageExecution stage); static final String CANARY_ANALYSIS_EXECUTION_RESULT; }