Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky connection manager workflow test #14271

Merged
merged 9 commits into from
Jun 30, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.RepeatedTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.params.ParameterizedTest;
Expand Down Expand Up @@ -407,7 +408,7 @@ public void cancelNonRunning() throws InterruptedException {
Mockito.verifyNoInteractions(mJobCreationAndStatusUpdateActivity);
}

@Test
@RepeatedTest(100)
@Timeout(value = 2,
unit = TimeUnit.SECONDS)
@DisplayName("Test that the sync is properly deleted")
Expand All @@ -429,7 +430,7 @@ public void deleteSync() throws InterruptedException {
startWorkflowAndWaitUntilReady(workflow, input);
testEnv.sleep(Duration.ofSeconds(30L));
workflow.deleteConnection();
testEnv.sleep(Duration.ofMinutes(20L));
Thread.sleep(500);

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

Expand Down Expand Up @@ -637,7 +638,7 @@ public void deleteRunning() throws InterruptedException {
.jobCancelledWithAttemptNumber(Mockito.argThat(new HasCancellationFailure(JOB_ID, ATTEMPT_ID)));
}

@Test
@RepeatedTest(100)
@Timeout(value = 2,
unit = TimeUnit.SECONDS)
@DisplayName("Test that resetting a non-running workflow starts a reset job")
Expand All @@ -659,7 +660,7 @@ public void resetStart() throws InterruptedException {
startWorkflowAndWaitUntilReady(workflow, input);
testEnv.sleep(Duration.ofMinutes(5L));
workflow.resetConnection();
testEnv.sleep(Duration.ofMinutes(15L));
Thread.sleep(500);

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

Expand All @@ -669,7 +670,7 @@ public void resetStart() throws InterruptedException {

}

@Test
@RepeatedTest(100)
@Timeout(value = 60,
unit = TimeUnit.SECONDS)
@DisplayName("Test that resetting a running workflow cancels the running workflow")
Expand All @@ -694,7 +695,7 @@ public void resetCancelRunningWorkflow() throws InterruptedException {
workflow.submitManualSync();
testEnv.sleep(Duration.ofSeconds(30L));
workflow.resetConnection();
testEnv.sleep(Duration.ofMinutes(15L));
Thread.sleep(500);

final Queue<ChangedStateEvent> eventQueue = testStateListener.events(testId);
final List<ChangedStateEvent> events = new ArrayList<>(eventQueue);
Expand All @@ -713,11 +714,10 @@ public void resetCancelRunningWorkflow() throws InterruptedException {

}

@Test
@RepeatedTest(100)
@Timeout(value = 60,
unit = TimeUnit.SECONDS)
@DisplayName("Test that cancelling a reset deletes streamsToReset from stream_resets table")
@Disabled
public void cancelResetRemovesStreamsToReset() throws InterruptedException {
final UUID connectionId = UUID.randomUUID();
final UUID testId = UUID.randomUUID();
Expand All @@ -738,7 +738,7 @@ public void cancelResetRemovesStreamsToReset() throws InterruptedException {

testEnv.sleep(Duration.ofSeconds(30L));
workflow.cancelJob();
testEnv.sleep(Duration.ofMinutes(15L));
Thread.sleep(500);

Mockito.verify(mStreamResetActivity).deleteStreamResetRecordsForJob(new DeleteStreamResetRecordsForJobInput(connectionId, JOB_ID));
}
Expand Down