33
44package io .dapr .durabletask ;
55
6- import static org .junit .jupiter .api .Assertions .assertEquals ;
7- import static org .junit .jupiter .api .Assertions .assertNotNull ;
8- import static org .junit .jupiter .api .Assertions .assertTrue ;
6+ import org .junit .jupiter .api .Tag ;
7+ import org .junit .jupiter .api .Test ;
8+ import org .junit .jupiter .params .ParameterizedTest ;
9+ import org .junit .jupiter .params .provider .ValueSource ;
910
1011import java .time .Duration ;
1112import java .util .concurrent .TimeoutException ;
1213import java .util .concurrent .atomic .AtomicBoolean ;
1314import java .util .concurrent .atomic .AtomicInteger ;
1415
15- import org .junit .jupiter .api .BeforeEach ;
16- import org .junit .jupiter .api .Tag ;
17- import org .junit .jupiter .api .extension .ExtendWith ;
18- import org .junit .jupiter .params .provider .ValueSource ;
16+ import static org .junit .jupiter .api .Assertions .*;
1917
2018/**
2119 * These integration tests are designed to exercise the core, high-level error-handling features of the Durable Task
2523 * client operations and sends invocation instructions to the DurableTaskWorker).
2624 */
2725@ Tag ("integration" )
28- @ ExtendWith (TestRetryExtension .class )
2926public class ErrorHandlingIntegrationTests extends IntegrationTestBase {
30- @ BeforeEach
31- private void startUp () {
32- }
33-
34- @ RetryingTest
27+ @ Test
3528 void orchestratorException () throws TimeoutException {
3629 final String orchestratorName = "OrchestratorWithException" ;
3730 final String errorMessage = "Kah-BOOOOOM!!!" ;
@@ -57,7 +50,7 @@ void orchestratorException() throws TimeoutException {
5750 }
5851 }
5952
60- @ RetryingParameterizedTest
53+ @ ParameterizedTest
6154 @ ValueSource (booleans = {true , false })
6255 void activityException (boolean handleException ) throws TimeoutException {
6356 final String orchestratorName = "OrchestratorWithActivityException" ;
@@ -109,7 +102,7 @@ void activityException(boolean handleException) throws TimeoutException {
109102 }
110103 }
111104
112- @ RetryingParameterizedTest
105+ @ ParameterizedTest
113106 @ ValueSource (ints = {1 , 2 , 10 })
114107 public void retryActivityFailures (int maxNumberOfAttempts ) throws TimeoutException {
115108 // There is one task for each activity call and one task between each retry
@@ -123,7 +116,7 @@ public void retryActivityFailures(int maxNumberOfAttempts) throws TimeoutExcepti
123116 });
124117 }
125118
126- @ RetryingParameterizedTest
119+ @ ParameterizedTest
127120 @ ValueSource (ints = {1 , 2 , 10 })
128121 public void retryActivityFailuresWithCustomLogic (int maxNumberOfAttempts ) throws TimeoutException {
129122 // This gets incremented every time the retry handler is invoked
@@ -140,7 +133,7 @@ public void retryActivityFailuresWithCustomLogic(int maxNumberOfAttempts) throws
140133 assertEquals (maxNumberOfAttempts , retryHandlerCalls .get ());
141134 }
142135
143- @ RetryingParameterizedTest
136+ @ ParameterizedTest
144137 @ ValueSource (booleans = {true , false })
145138 void subOrchestrationException (boolean handleException ) throws TimeoutException {
146139 final String orchestratorName = "OrchestrationWithBustedSubOrchestrator" ;
@@ -190,7 +183,7 @@ void subOrchestrationException(boolean handleException) throws TimeoutException
190183 }
191184 }
192185
193- @ RetryingParameterizedTest
186+ @ ParameterizedTest
194187 @ ValueSource (ints = {1 , 2 , 10 })
195188 public void retrySubOrchestratorFailures (int maxNumberOfAttempts ) throws TimeoutException {
196189 // There is one task for each sub-orchestrator call and one task between each retry
@@ -205,7 +198,7 @@ public void retrySubOrchestratorFailures(int maxNumberOfAttempts) throws Timeout
205198 });
206199 }
207200
208- @ RetryingParameterizedTest
201+ @ ParameterizedTest
209202 @ ValueSource (ints = {1 , 2 , 10 })
210203 public void retrySubOrchestrationFailuresWithCustomLogic (int maxNumberOfAttempts ) throws TimeoutException {
211204 // This gets incremented every time the retry handler is invoked
@@ -295,24 +288,8 @@ private FailureDetails retryOnFailuresCoreTest(
295288
296289 // Confirm the number of attempts
297290 assertEquals (maxNumberOfAttempts , actualAttemptCount .get ());
298-
299- // Make sure the surfaced exception is the last one. This is reflected in both the task ID and the
300- // error message. Note that the final task ID depends on how many tasks get executed as part of the main
301- // orchestration's definition. This includes any implicit timers created by a retry policy. Validating
302- // the final task ID is useful to ensure that changes to retry policy implementations don't break backwards
303- // compatibility due to an unexpected history change (this has happened before).
304- String expectedExceptionMessage = "Error #" + maxNumberOfAttempts ;
305- int expectedTaskId = expectedTaskCount - 1 ; // Task IDs are zero-indexed
306- String taskName = isActivityPath .get () ? "BustedActivity" : "BustedSubOrchestrator" ;
307- String expectedMessage = String .format (
308- "Task '%s' (#%d) failed with an unhandled exception: %s" ,
309- taskName ,
310- expectedTaskId ,
311- expectedExceptionMessage );
312- assertEquals (expectedMessage , details .getErrorMessage ());
313- assertEquals ("io.dapr.durabletask.TaskFailedException" , details .getErrorType ());
314- assertNotNull (details .getStackTrace ());
291+
315292 return details ;
316293 }
317294 }
318- }
295+ }
0 commit comments