Skip to content

Commit 65878ec

Browse files
committed
Update test assertions
1 parent 58b08fb commit 65878ec

File tree

1 file changed

+29
-63
lines changed

1 file changed

+29
-63
lines changed

tests/nexus/test_workflow_caller.py

Lines changed: 29 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,8 +1196,8 @@ def parse_exception(
11961196
# Java
11971197
_ = [
11981198
"NexusOperationError",
1199-
"HandlerError('handler error: application error', type='APPLICATION_ERROR', non_retryable=True)",
1200-
"ApplicationError('application error', type='APPLICATION_ERROR', non_retryable=True)",
1199+
"HandlerError('handler error: message='application error 1', type='my-application-error-type', nonRetryable=true', type='INTERNAL', nonRetryable=true)",
1200+
"ApplicationError('application error 1', type='my-application-error-type', nonRetryable=true)",
12011201
]
12021202

12031203
error_conversion_test_cases.append(
@@ -1208,50 +1208,16 @@ def parse_exception(
12081208
(
12091209
nexusrpc.HandlerError,
12101210
{
1211-
"message": "application error",
1212-
"type": "APPLICATION_ERROR",
1211+
"message": "handler error: message='application error 1', type='my-application-error-type', nonRetryable=true",
1212+
"type": "INTERNAL",
12131213
"non_retryable": True,
12141214
},
12151215
),
12161216
(
12171217
ApplicationError,
12181218
{
1219-
"message": "application error",
1220-
"type": "APPLICATION_ERROR",
1221-
"non_retryable": True,
1222-
},
1223-
),
1224-
],
1225-
)
1226-
)
1227-
1228-
1229-
# custom_error:
1230-
_ = ["NexusOperationError", "HandlerError"]
1231-
# Java
1232-
_ = [
1233-
"NexusOperationError",
1234-
"HandlerError('Custom error wrapped: custom error', type='CUSTOM_ERROR', non_retryable=True)",
1235-
"ApplicationError('Custom error wrapped: custom error', type='CUSTOM_ERROR', non_retryable=True)",
1236-
]
1237-
error_conversion_test_cases.append(
1238-
ErrorConversionTestCase(
1239-
name="custom_error",
1240-
java_behavior=[
1241-
(NexusOperationError, {}),
1242-
(
1243-
nexusrpc.HandlerError,
1244-
{
1245-
"message": "Custom error wrapped: custom error",
1246-
"type": "CUSTOM_ERROR",
1247-
"non_retryable": True,
1248-
},
1249-
),
1250-
(
1251-
ApplicationError,
1252-
{
1253-
"message": "Custom error wrapped: custom error",
1254-
"type": "CUSTOM_ERROR",
1219+
"message": "application error 1",
1220+
"type": "my-application-error-type",
12551221
"non_retryable": True,
12561222
},
12571223
),
@@ -1277,9 +1243,9 @@ def parse_exception(
12771243
# Java
12781244
_ = [
12791245
"NexusOperationError",
1280-
"HandlerError('handler error: application error', type='APPLICATION_ERROR', non_retryable=True)",
1281-
"ApplicationError('application error', type='APPLICATION_ERROR', non_retryable=True)",
1282-
"ApplicationError('custom error', type='MyCustomException', non_retryable=False)",
1246+
"HandlerError('handler error: message='application error 1', type='my-application-error-type', nonRetryable=true', type='INTERNAL', nonRetryable=true)",
1247+
"ApplicationError('application error 1', type='my-application-error-type', nonRetryable=true)",
1248+
"ApplicationError('Custom error 2', type='io.temporal.samples.nexus.handler.NexusServiceImpl$MyCustomException', nonRetryable=false)",
12831249
]
12841250

12851251
error_conversion_test_cases.append(
@@ -1290,24 +1256,24 @@ def parse_exception(
12901256
(
12911257
nexusrpc.HandlerError,
12921258
{
1293-
"message": "handler error: application error",
1294-
"type": "APPLICATION_ERROR",
1259+
"message": "handler error: message='application error 1', type='my-application-error-type', nonRetryable=true",
1260+
"type": "INTERNAL",
12951261
"non_retryable": True,
12961262
},
12971263
),
12981264
(
12991265
ApplicationError,
13001266
{
1301-
"message": "application error",
1302-
"type": "APPLICATION_ERROR",
1267+
"message": "application error 1",
1268+
"type": "my-application-error-type",
13031269
"non_retryable": True,
13041270
},
13051271
),
13061272
(
13071273
ApplicationError,
13081274
{
1309-
"message": "custom error",
1310-
"type": "MyCustomException",
1275+
"message": "Custom error 2",
1276+
"type": "io.temporal.samples.nexus.handler.NexusServiceImpl$MyCustomException",
13111277
"non_retryable": False,
13121278
},
13131279
),
@@ -1320,8 +1286,8 @@ def parse_exception(
13201286
# Java
13211287
_ = [
13221288
"NexusOperationError",
1323-
"HandlerError('handler error: handler error', type='RuntimeException', non_retryable=False)",
1324-
"ApplicationError('handler error', type='RuntimeException', non_retryable=False)",
1289+
"HandlerError('handler error: message='Handler error 1', type='java.lang.RuntimeException', nonRetryable=false', type='NOT_FOUND', nonRetryable=true)",
1290+
"ApplicationError('Handler error 1', type='java.lang.RuntimeException', nonRetryable=false)",
13251291
]
13261292

13271293
error_conversion_test_cases.append(
@@ -1332,16 +1298,16 @@ def parse_exception(
13321298
(
13331299
nexusrpc.HandlerError,
13341300
{
1335-
"message": "handler error: handler error",
1336-
"type": "RuntimeException",
1337-
"non_retryable": False,
1301+
"message": "handler error: message='Handler error 1', type='java.lang.RuntimeException', nonRetryable=false",
1302+
"type": "NOT_FOUND",
1303+
"non_retryable": True,
13381304
},
13391305
),
13401306
(
13411307
ApplicationError,
13421308
{
1343-
"message": "handler error",
1344-
"type": "RuntimeException",
1309+
"message": "Handler error 1",
1310+
"type": "java.lang.RuntimeException",
13451311
"non_retryable": False,
13461312
},
13471313
),
@@ -1362,12 +1328,12 @@ def parse_exception(
13621328

13631329

13641330
# nexus_operation_error_from_application_error_non_retryable_from_custom_error:
1365-
_ = ["NexusOperationError", "ApplicationError", "ApplicationError", "ApplicationError"]
1331+
_ = ["NexusOperationError", "ApplicationError", "ApplicationError"]
13661332
# Java
13671333
_ = [
13681334
"NexusOperationError",
1369-
"ApplicationError('application error', type='APPLICATION_ERROR', non_retryable=True)",
1370-
"ApplicationError('custom error', type='MyCustomException', non_retryable=False)",
1335+
"ApplicationError('application error 1', type='my-application-error-type', nonRetryable=true)",
1336+
"ApplicationError('Custom error 2', type='io.temporal.samples.nexus.handler.NexusServiceImpl$MyCustomException', nonRetryable=false)",
13711337
]
13721338
error_conversion_test_cases.append(
13731339
ErrorConversionTestCase(
@@ -1377,16 +1343,16 @@ def parse_exception(
13771343
(
13781344
ApplicationError,
13791345
{
1380-
"message": "application error",
1381-
"type": "APPLICATION_ERROR",
1346+
"message": "application error 1",
1347+
"type": "my-application-error-type",
13821348
"non_retryable": True,
13831349
},
13841350
),
13851351
(
13861352
ApplicationError,
13871353
{
1388-
"message": "custom error",
1389-
"type": "MyCustomException",
1354+
"message": "Custom error 2",
1355+
"type": "io.temporal.samples.nexus.handler.NexusServiceImpl$MyCustomException",
13901356
"non_retryable": False,
13911357
},
13921358
),

0 commit comments

Comments
 (0)