Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
id 'maven-publish'
id 'signing'
id 'com.github.spotbugs' version '5.2.1'
id 'org.gradle.test-retry' version '1.4.1'
}

group 'com.microsoft'
Expand Down Expand Up @@ -110,6 +111,11 @@ test {
// and require external dependencies.
excludeTags "integration"
}

retry {
maxRetries = 2
maxFailures = 5
}
}

// Unlike normal unit tests, some tests are considered "integration tests" and shouldn't be
Expand All @@ -125,6 +131,12 @@ task integrationTest(type: Test) {
testLogging.showStandardStreams = true

ignoreFailures = false

// Add retry capability for flaky integration tests
retry {
maxRetries = 3
maxFailures = 10
}
}

publishing {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.junit.jupiter.api.extension.ExtendWith;

import java.time.Duration;
import java.util.concurrent.TimeoutException;
Expand All @@ -25,15 +24,16 @@
* client operations and sends invocation instructions to the DurableTaskWorker).
*/
@Tag("integration")
@ExtendWith(TestRetryExtension.class)
public class ErrorHandlingIntegrationTests extends IntegrationTestBase {

@BeforeEach
private void startUp() {
DurableTaskClient client = new DurableTaskGrpcClientBuilder().build();
client.deleteTaskHub();
try(DurableTaskClient client = new DurableTaskGrpcClientBuilder().build()) {
client.deleteTaskHub();
}
}

@RetryingTest
@Test
void orchestratorException() throws TimeoutException {
final String orchestratorName = "OrchestratorWithException";
final String errorMessage = "Kah-BOOOOOM!!!";
Expand All @@ -59,7 +59,7 @@ void orchestratorException() throws TimeoutException {
}
}

@RetryingParameterizedTest
@ParameterizedTest
@ValueSource(booleans = {true, false})
void activityException(boolean handleException) throws TimeoutException {
final String orchestratorName = "OrchestratorWithActivityException";
Expand Down Expand Up @@ -111,7 +111,7 @@ void activityException(boolean handleException) throws TimeoutException {
}
}

@RetryingParameterizedTest
@ParameterizedTest
@ValueSource(ints = {1, 2, 10})
public void retryActivityFailures(int maxNumberOfAttempts) throws TimeoutException {
// There is one task for each activity call and one task between each retry
Expand All @@ -125,7 +125,7 @@ public void retryActivityFailures(int maxNumberOfAttempts) throws TimeoutExcepti
});
}

@RetryingParameterizedTest
@ParameterizedTest
@ValueSource(ints = {1, 2, 10})
public void retryActivityFailuresWithCustomLogic(int maxNumberOfAttempts) throws TimeoutException {
// This gets incremented every time the retry handler is invoked
Expand All @@ -142,7 +142,7 @@ public void retryActivityFailuresWithCustomLogic(int maxNumberOfAttempts) throws
assertEquals(maxNumberOfAttempts, retryHandlerCalls.get());
}

@RetryingParameterizedTest
@ParameterizedTest
@ValueSource(booleans = {true, false})
void subOrchestrationException(boolean handleException) throws TimeoutException {
final String orchestratorName = "OrchestrationWithBustedSubOrchestrator";
Expand Down Expand Up @@ -192,7 +192,7 @@ void subOrchestrationException(boolean handleException) throws TimeoutException
}
}

@RetryingParameterizedTest
@ParameterizedTest
@ValueSource(ints = {1, 2, 10})
public void retrySubOrchestratorFailures(int maxNumberOfAttempts) throws TimeoutException {
// There is one task for each sub-orchestrator call and one task between each retry
Expand All @@ -207,7 +207,7 @@ public void retrySubOrchestratorFailures(int maxNumberOfAttempts) throws Timeout
});
}

@RetryingParameterizedTest
@ParameterizedTest
@ValueSource(ints = {1, 2, 10})
public void retrySubOrchestrationFailuresWithCustomLogic(int maxNumberOfAttempts) throws TimeoutException {
// This gets incremented every time the retry handler is invoked
Expand Down
Loading
Loading