Skip to content

Commit 0ed15f2

Browse files
authored
Bmoric/improve flakiness (#9853)
Improve some test that were flaky because of their asynchronous nature.
1 parent eccee12 commit 0ed15f2

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

airbyte-workers/src/test/java/io/airbyte/workers/temporal/scheduling/ConnectionManagerWorkflowTest.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ public void deleteSync() {
355355
}
356356

357357
@Nested
358-
@DisplayName("Test which without a long running child workflow")
358+
@DisplayName("Test which with a long running child workflow")
359359
class SynchronousWorkflow {
360360

361361
@BeforeEach
@@ -399,14 +399,14 @@ public void manualRun() {
399399
WorkflowClient.start(workflow::run, input);
400400
testEnv.sleep(Duration.ofMinutes(2L));
401401
workflow.submitManualSync();
402+
testEnv.shutdown();
402403

403404
final Queue<ChangedStateEvent> events = testStateListener.events(testId);
404405

405406
Assertions.assertThat(events)
406407
.filteredOn(changedStateEvent -> changedStateEvent.getField() == StateField.SKIPPED_SCHEDULING && changedStateEvent.isValue())
407408
.isEmpty();
408409

409-
testEnv.shutdown();
410410
}
411411

412412
@Test
@@ -428,9 +428,10 @@ public void cancelRunning() {
428428

429429
WorkflowClient.start(workflow::run, input);
430430
workflow.submitManualSync();
431-
testEnv.sleep(Duration.ofSeconds(30L));
431+
testEnv.sleep(Duration.ofSeconds(10L));
432432
workflow.cancelJob();
433-
testEnv.sleep(Duration.ofMinutes(1L));
433+
testEnv.sleep(Duration.ofMinutes(2L));
434+
testEnv.shutdown();
434435

435436
final Queue<ChangedStateEvent> events = testStateListener.events(testId);
436437

@@ -439,8 +440,6 @@ public void cancelRunning() {
439440
.hasSizeGreaterThanOrEqualTo(1);
440441

441442
Mockito.verify(mJobCreationAndStatusUpdateActivity).jobCancelled(Mockito.any());
442-
443-
testEnv.shutdown();
444443
}
445444

446445
@Test
@@ -464,6 +463,7 @@ public void resetStart() {
464463
testEnv.sleep(Duration.ofSeconds(30L));
465464
workflow.resetConnection();
466465
testEnv.sleep(Duration.ofSeconds(90L));
466+
testEnv.shutdown();
467467

468468
final Queue<ChangedStateEvent> events = testStateListener.events(testId);
469469

@@ -473,7 +473,6 @@ public void resetStart() {
473473

474474
Mockito.verify(mJobCreationAndStatusUpdateActivity).jobSuccess(Mockito.any());
475475

476-
testEnv.shutdown();
477476
}
478477

479478
@Test
@@ -497,7 +496,8 @@ public void resetCancelRunningWorkflow() {
497496
workflow.submitManualSync();
498497
testEnv.sleep(Duration.ofSeconds(30L));
499498
workflow.resetConnection();
500-
testEnv.sleep(Duration.ofSeconds(30L));
499+
testEnv.sleep(Duration.ofMinutes(2L));
500+
testEnv.shutdown();
501501

502502
final Queue<ChangedStateEvent> events = testStateListener.events(testId);
503503

@@ -507,7 +507,6 @@ public void resetCancelRunningWorkflow() {
507507

508508
Mockito.verify(mJobCreationAndStatusUpdateActivity).jobCancelled(Mockito.any());
509509

510-
testEnv.shutdown();
511510
}
512511

513512
@Test

0 commit comments

Comments
 (0)