Skip to content

Commit 140f934

Browse files
authored
Fix integration test retry extension (#227)
* Fix integration test retry extension The integration tests were using a retry extension that was eating exceptions and hiding failures. This commit removes the customer extension and relies on gradle's built in retry. Signed-off-by: Hal Spang <halspang@microsoft.com>
1 parent 402b88e commit 140f934

6 files changed

Lines changed: 68 additions & 151 deletions

File tree

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: 11 additions & 11 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,15 +24,16 @@
2524
* client operations and sends invocation instructions to the DurableTaskWorker).
2625
*/
2726
@Tag("integration")
28-
@ExtendWith(TestRetryExtension.class)
2927
public class ErrorHandlingIntegrationTests extends IntegrationTestBase {
28+
3029
@BeforeEach
3130
private void startUp() {
32-
DurableTaskClient client = new DurableTaskGrpcClientBuilder().build();
33-
client.deleteTaskHub();
31+
try(DurableTaskClient client = new DurableTaskGrpcClientBuilder().build()) {
32+
client.deleteTaskHub();
33+
}
3434
}
3535

36-
@RetryingTest
36+
@Test
3737
void orchestratorException() throws TimeoutException {
3838
final String orchestratorName = "OrchestratorWithException";
3939
final String errorMessage = "Kah-BOOOOOM!!!";
@@ -59,7 +59,7 @@ void orchestratorException() throws TimeoutException {
5959
}
6060
}
6161

62-
@RetryingParameterizedTest
62+
@ParameterizedTest
6363
@ValueSource(booleans = {true, false})
6464
void activityException(boolean handleException) throws TimeoutException {
6565
final String orchestratorName = "OrchestratorWithActivityException";
@@ -111,7 +111,7 @@ void activityException(boolean handleException) throws TimeoutException {
111111
}
112112
}
113113

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

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

145-
@RetryingParameterizedTest
145+
@ParameterizedTest
146146
@ValueSource(booleans = {true, false})
147147
void subOrchestrationException(boolean handleException) throws TimeoutException {
148148
final String orchestratorName = "OrchestrationWithBustedSubOrchestrator";
@@ -192,7 +192,7 @@ void subOrchestrationException(boolean handleException) throws TimeoutException
192192
}
193193
}
194194

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

210-
@RetryingParameterizedTest
210+
@ParameterizedTest
211211
@ValueSource(ints = {1, 2, 10})
212212
public void retrySubOrchestrationFailuresWithCustomLogic(int maxNumberOfAttempts) throws TimeoutException {
213213
// This gets incremented every time the retry handler is invoked

0 commit comments

Comments
 (0)