Skip to content

Commit 44742e9

Browse files
committed
Update to use built-in gradle retry
Signed-off-by: Hal Spang <[email protected]>
1 parent e89e1dd commit 44742e9

File tree

4 files changed

+13
-42
lines changed

4 files changed

+13
-42
lines changed

client/build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ plugins {
66
id 'maven-publish'
77
id 'signing'
88
id 'com.github.spotbugs' version '5.2.1'
9+
id 'org.gradle.test-retry' version '1.4.1'
910
}
1011

1112
group 'com.microsoft'
@@ -110,6 +111,11 @@ test {
110111
// and require external dependencies.
111112
excludeTags "integration"
112113
}
114+
115+
retry {
116+
maxRetries = 2
117+
maxFailures = 5
118+
}
113119
}
114120

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

127133
ignoreFailures = false
134+
135+
// Add retry capability for flaky integration tests
136+
retry {
137+
maxRetries = 3
138+
maxFailures = 10
139+
}
128140
}
129141

130142
publishing {

client/src/test/java/com/microsoft/durabletask/ErrorHandlingIntegrationTests.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import org.junit.jupiter.api.Test;
88
import org.junit.jupiter.params.ParameterizedTest;
99
import org.junit.jupiter.params.provider.ValueSource;
10-
import org.junit.jupiter.api.extension.ExtendWith;
1110

1211
import java.time.Duration;
1312
import java.util.concurrent.TimeoutException;
@@ -25,7 +24,6 @@
2524
* client operations and sends invocation instructions to the DurableTaskWorker).
2625
*/
2726
@Tag("integration")
28-
@ExtendWith(TestRetryExtension.class)
2927
public class ErrorHandlingIntegrationTests extends IntegrationTestBase {
3028

3129
@BeforeEach
@@ -198,7 +196,7 @@ void subOrchestrationException(boolean handleException) throws TimeoutException
198196
@ValueSource(ints = {1, 2, 10})
199197
public void retrySubOrchestratorFailures(int maxNumberOfAttempts) throws TimeoutException {
200198
// There is one task for each sub-orchestrator call and one task between each retry
201-
int expectedTaskCount = (maxNumberOfAttempts * 2);
199+
int expectedTaskCount = (maxNumberOfAttempts * 2) - 1;
202200
this.retryOnFailuresCoreTest(maxNumberOfAttempts, expectedTaskCount, ctx -> {
203201
RetryPolicy retryPolicy = getCommonRetryPolicy(maxNumberOfAttempts);
204202
ctx.callSubOrchestrator(

client/src/test/java/com/microsoft/durabletask/IntegrationTests.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import org.junit.jupiter.api.Disabled;
2020
import org.junit.jupiter.api.Tag;
2121
import org.junit.jupiter.api.Test;
22-
import org.junit.jupiter.api.extension.ExtendWith;
2322
import org.junit.jupiter.params.ParameterizedTest;
2423
import org.junit.jupiter.params.provider.ValueSource;
2524

@@ -34,7 +33,6 @@
3433
* sends invocation instructions to the DurableTaskWorker).
3534
*/
3635
@Tag("integration")
37-
@ExtendWith(TestRetryExtension.class)
3836
public class IntegrationTests extends IntegrationTestBase {
3937
static final Duration defaultTimeout = Duration.ofSeconds(100);
4038
// All tests that create a server should save it to this variable for proper shutdown

client/src/test/java/com/microsoft/durabletask/TestRetryExtension.java

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)