3
3
4
4
package io .dapr .durabletask ;
5
5
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 ;
9
10
10
11
import java .time .Duration ;
11
12
import java .util .concurrent .TimeoutException ;
12
13
import java .util .concurrent .atomic .AtomicBoolean ;
13
14
import java .util .concurrent .atomic .AtomicInteger ;
14
15
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 .*;
19
17
20
18
/**
21
19
* These integration tests are designed to exercise the core, high-level error-handling features of the Durable Task
25
23
* client operations and sends invocation instructions to the DurableTaskWorker).
26
24
*/
27
25
@ Tag ("integration" )
28
- @ ExtendWith (TestRetryExtension .class )
29
26
public class ErrorHandlingIntegrationTests extends IntegrationTestBase {
30
- @ BeforeEach
31
- private void startUp () {
32
- }
33
-
34
- @ RetryingTest
27
+ @ Test
35
28
void orchestratorException () throws TimeoutException {
36
29
final String orchestratorName = "OrchestratorWithException" ;
37
30
final String errorMessage = "Kah-BOOOOOM!!!" ;
@@ -57,7 +50,7 @@ void orchestratorException() throws TimeoutException {
57
50
}
58
51
}
59
52
60
- @ RetryingParameterizedTest
53
+ @ ParameterizedTest
61
54
@ ValueSource (booleans = {true , false })
62
55
void activityException (boolean handleException ) throws TimeoutException {
63
56
final String orchestratorName = "OrchestratorWithActivityException" ;
@@ -109,7 +102,7 @@ void activityException(boolean handleException) throws TimeoutException {
109
102
}
110
103
}
111
104
112
- @ RetryingParameterizedTest
105
+ @ ParameterizedTest
113
106
@ ValueSource (ints = {1 , 2 , 10 })
114
107
public void retryActivityFailures (int maxNumberOfAttempts ) throws TimeoutException {
115
108
// 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
123
116
});
124
117
}
125
118
126
- @ RetryingParameterizedTest
119
+ @ ParameterizedTest
127
120
@ ValueSource (ints = {1 , 2 , 10 })
128
121
public void retryActivityFailuresWithCustomLogic (int maxNumberOfAttempts ) throws TimeoutException {
129
122
// This gets incremented every time the retry handler is invoked
@@ -140,7 +133,7 @@ public void retryActivityFailuresWithCustomLogic(int maxNumberOfAttempts) throws
140
133
assertEquals (maxNumberOfAttempts , retryHandlerCalls .get ());
141
134
}
142
135
143
- @ RetryingParameterizedTest
136
+ @ ParameterizedTest
144
137
@ ValueSource (booleans = {true , false })
145
138
void subOrchestrationException (boolean handleException ) throws TimeoutException {
146
139
final String orchestratorName = "OrchestrationWithBustedSubOrchestrator" ;
@@ -190,7 +183,7 @@ void subOrchestrationException(boolean handleException) throws TimeoutException
190
183
}
191
184
}
192
185
193
- @ RetryingParameterizedTest
186
+ @ ParameterizedTest
194
187
@ ValueSource (ints = {1 , 2 , 10 })
195
188
public void retrySubOrchestratorFailures (int maxNumberOfAttempts ) throws TimeoutException {
196
189
// 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
205
198
});
206
199
}
207
200
208
- @ RetryingParameterizedTest
201
+ @ ParameterizedTest
209
202
@ ValueSource (ints = {1 , 2 , 10 })
210
203
public void retrySubOrchestrationFailuresWithCustomLogic (int maxNumberOfAttempts ) throws TimeoutException {
211
204
// This gets incremented every time the retry handler is invoked
@@ -295,24 +288,8 @@ private FailureDetails retryOnFailuresCoreTest(
295
288
296
289
// Confirm the number of attempts
297
290
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
+
315
292
return details ;
316
293
}
317
294
}
318
- }
295
+ }
0 commit comments