Skip to content

Commit

Permalink
Add test delays (airbytehq#9268)
Browse files Browse the repository at this point in the history
increase test waiting time in order to make them less flaky
  • Loading branch information
benmoriceau authored Jan 4, 2022
1 parent cb68e51 commit a24a287
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ public void manualRun() {
workflowState);

WorkflowClient.start(workflow::run, input);
testEnv.sleep(Duration.ofSeconds(2L));
testEnv.sleep(Duration.ofSeconds(30L));
workflow.submitManualSync();
testEnv.sleep(Duration.ofSeconds(50L));
testEnv.sleep(Duration.ofSeconds(20L));

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

Expand Down Expand Up @@ -231,9 +231,9 @@ public void updatedSignalRecieved() {
workflowState);

WorkflowClient.start(workflow::run, input);
testEnv.sleep(Duration.ofSeconds(2L));
testEnv.sleep(Duration.ofSeconds(30L));
workflow.connectionUpdated();
testEnv.sleep(Duration.ofSeconds(50L));
testEnv.sleep(Duration.ofSeconds(20L));

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

Expand Down Expand Up @@ -272,9 +272,9 @@ public void cancelNonRunning() {
workflowState);

WorkflowClient.start(workflow::run, input);
testEnv.sleep(Duration.ofSeconds(50L));
testEnv.sleep(Duration.ofSeconds(30L));
workflow.cancelJob();
testEnv.sleep(Duration.ofSeconds(2L));
testEnv.sleep(Duration.ofSeconds(20L));

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

Expand Down Expand Up @@ -313,8 +313,9 @@ public void deleteSync() {
workflowState);

WorkflowClient.start(workflow::run, input);
testEnv.sleep(Duration.ofSeconds(30L));
workflow.deleteConnection();
testEnv.sleep(Duration.ofSeconds(50L));
testEnv.sleep(Duration.ofMinutes(20L));

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

Expand Down Expand Up @@ -380,7 +381,7 @@ public void manualRun() {
workflowState);

WorkflowClient.start(workflow::run, input);
testEnv.sleep(Duration.ofSeconds(61L));
testEnv.sleep(Duration.ofMinutes(2L));
workflow.submitManualSync();

final Queue<ChangedStateEvent> events = testStateListener.events(testId);
Expand Down Expand Up @@ -410,15 +411,15 @@ public void cancelRunning() {

WorkflowClient.start(workflow::run, input);
workflow.submitManualSync();
testEnv.sleep(Duration.ofSeconds(1L));
testEnv.sleep(Duration.ofSeconds(30L));
workflow.cancelJob();
testEnv.sleep(Duration.ofSeconds(2L));
testEnv.sleep(Duration.ofMinutes(1L));

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

Assertions.assertThat(events)
.filteredOn(changedStateEvent -> changedStateEvent.getField() == StateField.CANCELLED && changedStateEvent.isValue())
.hasSize(1);
.hasSizeGreaterThanOrEqualTo(1);

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public StandardSyncOutput run(final JobRunConfig jobRunConfig,
final StandardSyncInput syncInput,
final UUID connectionId) {

Workflow.sleep(Duration.ofSeconds(2));
Workflow.sleep(Duration.ofMinutes(1));

return new StandardSyncOutput();
}
Expand Down

0 comments on commit a24a287

Please sign in to comment.