jackjlli commented on code in PR #8999: URL: https://github.com/apache/pinot/pull/8999#discussion_r911318797
########## pinot-controller/src/test/java/org/apache/pinot/controller/helix/core/minion/PinotTaskManagerStatelessTest.java: ########## @@ -239,10 +242,20 @@ private void validateJob(String taskType, String cronExpression) throw new RuntimeException(e); } }, TIMEOUT_IN_MS, "JobDetail exiting but missing JobTrigger"); - List<? extends Trigger> triggersOfJob = scheduler.getTriggersOfJob(jobKey); - Trigger trigger = triggersOfJob.iterator().next(); - assertTrue(trigger instanceof CronTrigger); - assertEquals(((CronTrigger) trigger).getCronExpression(), cronExpression); + + // There is no guarantee that previous changes have been applied, therefore we need to + // retry the check for a bit + TestUtils.waitForResult(() -> { Review Comment: You can use `waitForCondition` instead of `waitForResult`, as the logic here doesn't require to return anything. ########## pinot-controller/src/test/java/org/apache/pinot/controller/helix/core/minion/PinotTaskManagerStatelessTest.java: ########## @@ -239,10 +242,20 @@ private void validateJob(String taskType, String cronExpression) throw new RuntimeException(e); } }, TIMEOUT_IN_MS, "JobDetail exiting but missing JobTrigger"); - List<? extends Trigger> triggersOfJob = scheduler.getTriggersOfJob(jobKey); - Trigger trigger = triggersOfJob.iterator().next(); - assertTrue(trigger instanceof CronTrigger); - assertEquals(((CronTrigger) trigger).getCronExpression(), cronExpression); + + // There is no guarantee that previous changes have been applied, therefore we need to + // retry the check for a bit + TestUtils.waitForResult(() -> { + try { + List<? extends Trigger> triggersOfJob = scheduler.getTriggersOfJob(jobKey); + Trigger trigger = triggersOfJob.iterator().next(); + assertTrue(trigger instanceof CronTrigger); Review Comment: If `waitForCondition` is used, you may need to replace this assertion statement with returning true or false. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org