Skip to content

Commit 11afac5

Browse files
halspangjavier-aliaga
authored andcommitted
Fix integration test retry extension (microsoft#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 <[email protected]> Signed-off-by: Javier Aliaga <[email protected]>
1 parent 1dcf399 commit 11afac5

File tree

6 files changed

+69
-151
lines changed

6 files changed

+69
-151
lines changed

client/build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ plugins {
77
// id 'signing'
88
id 'com.github.spotbugs' version '5.2.1'
99
id 'org.jreleaser' version '1.18.0'
10+
id 'org.gradle.test-retry' version '1.4.1'
1011
}
1112

1213
group 'io.dapr'
@@ -122,6 +123,11 @@ test {
122123
// and require external dependencies.
123124
excludeTags "integration"
124125
}
126+
127+
retry {
128+
maxRetries = 2
129+
maxFailures = 5
130+
}
125131
}
126132

127133
// Unlike normal unit tests, some tests are considered "integration tests" and shouldn't be
@@ -137,6 +143,12 @@ task integrationTest(type: Test) {
137143
testLogging.showStandardStreams = true
138144

139145
ignoreFailures = false
146+
147+
// Add retry capability for flaky integration tests
148+
retry {
149+
maxRetries = 3
150+
maxFailures = 10
151+
}
140152
}
141153

142154
publishing {

client/src/test/java/io/dapr/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)