diff --git a/azkaban-web-server/src/test/java/azkaban/flowtrigger/TriggerInstanceProcessorTest.java b/azkaban-web-server/src/test/java/azkaban/flowtrigger/TriggerInstanceProcessorTest.java
index e8c1e4d..6d52ca9 100644
--- a/azkaban-web-server/src/test/java/azkaban/flowtrigger/TriggerInstanceProcessorTest.java
+++ b/azkaban-web-server/src/test/java/azkaban/flowtrigger/TriggerInstanceProcessorTest.java
@@ -65,6 +65,7 @@ public class TriggerInstanceProcessorTest {
private TriggerInstanceProcessor processor;
private CountDownLatch sendEmailLatch;
private CountDownLatch submitFlowLatch;
+ private CountDownLatch updateExecIDLatch;
private static TriggerInstance createTriggerInstance() throws ParseException {
final FlowTrigger flowTrigger = new FlowTrigger(
@@ -100,13 +101,13 @@ public class TriggerInstanceProcessorTest {
public void setUp() throws Exception {
this.message = EmailerTest.mockEmailMessage();
this.messageCreator = EmailerTest.mockMessageCreator(this.message);
-
this.triggerInstLoader = mock(FlowTriggerInstanceLoader.class);
this.executorManager = mock(ExecutorManager.class);
when(this.executorManager.submitExecutableFlow(any(), anyString())).thenReturn("return");
final CommonMetrics commonMetrics = new CommonMetrics(new MetricsManager(new MetricRegistry()));
this.emailer = Mockito.spy(new Emailer(EmailerTest.createMailProperties(), commonMetrics,
this.messageCreator));
+
this.sendEmailLatch = new CountDownLatch(1);
doAnswer(invocation -> {
this.sendEmailLatch.countDown();
@@ -119,6 +120,12 @@ public class TriggerInstanceProcessorTest {
return null;
}).when(this.executorManager).submitExecutableFlow(any(), anyString());
+ this.updateExecIDLatch = new CountDownLatch(1);
+ doAnswer(invocation -> {
+ this.updateExecIDLatch.countDown();
+ return null;
+ }).when(this.triggerInstLoader).updateAssociatedFlowExecId(any());
+
this.processor = new TriggerInstanceProcessor(this.executorManager, this.triggerInstLoader,
this.emailer);
}
@@ -129,6 +136,7 @@ public class TriggerInstanceProcessorTest {
this.processor.processSucceed(triggerInstance);
this.submitFlowLatch.await(10L, TimeUnit.SECONDS);
verify(this.executorManager).submitExecutableFlow(any(), anyString());
+ this.updateExecIDLatch.await(10L, TimeUnit.SECONDS);
verify(this.triggerInstLoader).updateAssociatedFlowExecId(triggerInstance);
}