Skip to content

Commit a15f678

Browse files
committed
Enhance integration tests by adding retry functionality. Updated test annotations to use @RetryingTest and @RetryingParameterizedTest, and included TestRetryExtension for improved error handling during test execution.
1 parent 78644d9 commit a15f678

File tree

6 files changed

+145
-773
lines changed

6 files changed

+145
-773
lines changed

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
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;
1011

1112
import java.time.Duration;
1213
import java.util.concurrent.TimeoutException;
@@ -24,14 +25,15 @@
2425
* client operations and sends invocation instructions to the DurableTaskWorker).
2526
*/
2627
@Tag("integration")
28+
@ExtendWith(TestRetryExtension.class)
2729
public class ErrorHandlingIntegrationTests extends IntegrationTestBase {
2830
@BeforeEach
2931
private void startUp() {
3032
DurableTaskClient client = new DurableTaskGrpcClientBuilder().build();
3133
client.deleteTaskHub();
3234
}
3335

34-
@Test
36+
@RetryingTest
3537
void orchestratorException() throws TimeoutException {
3638
final String orchestratorName = "OrchestratorWithException";
3739
final String errorMessage = "Kah-BOOOOOM!!!";
@@ -57,7 +59,7 @@ void orchestratorException() throws TimeoutException {
5759
}
5860
}
5961

60-
@ParameterizedTest
62+
@RetryingParameterizedTest
6163
@ValueSource(booleans = {true, false})
6264
void activityException(boolean handleException) throws TimeoutException {
6365
final String orchestratorName = "OrchestratorWithActivityException";
@@ -109,7 +111,7 @@ void activityException(boolean handleException) throws TimeoutException {
109111
}
110112
}
111113

112-
@ParameterizedTest
114+
@RetryingParameterizedTest
113115
@ValueSource(ints = {1, 2, 10})
114116
public void retryActivityFailures(int maxNumberOfAttempts) throws TimeoutException {
115117
// There is one task for each activity call and one task between each retry
@@ -123,7 +125,7 @@ public void retryActivityFailures(int maxNumberOfAttempts) throws TimeoutExcepti
123125
});
124126
}
125127

126-
@ParameterizedTest
128+
@RetryingParameterizedTest
127129
@ValueSource(ints = {1, 2, 10})
128130
public void retryActivityFailuresWithCustomLogic(int maxNumberOfAttempts) throws TimeoutException {
129131
// This gets incremented every time the retry handler is invoked
@@ -140,7 +142,7 @@ public void retryActivityFailuresWithCustomLogic(int maxNumberOfAttempts) throws
140142
assertEquals(maxNumberOfAttempts, retryHandlerCalls.get());
141143
}
142144

143-
@ParameterizedTest
145+
@RetryingParameterizedTest
144146
@ValueSource(booleans = {true, false})
145147
void subOrchestrationException(boolean handleException) throws TimeoutException {
146148
final String orchestratorName = "OrchestrationWithBustedSubOrchestrator";
@@ -190,7 +192,7 @@ void subOrchestrationException(boolean handleException) throws TimeoutException
190192
}
191193
}
192194

193-
@ParameterizedTest
195+
@RetryingParameterizedTest
194196
@ValueSource(ints = {1, 2, 10})
195197
public void retrySubOrchestratorFailures(int maxNumberOfAttempts) throws TimeoutException {
196198
// There is one task for each sub-orchestrator call and one task between each retry
@@ -205,7 +207,7 @@ public void retrySubOrchestratorFailures(int maxNumberOfAttempts) throws Timeout
205207
});
206208
}
207209

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

0 commit comments

Comments
 (0)