Skip to content

Commit d2a6ac4

Browse files
committed
Fix test server nexus failure wrapping and test assertions for server 1.31.0
- Update nexusFailureToAPIFailure to not wrap non-temporal failures in ApplicationFailureInfo (matching real server behavior) - Update handlerErrorToFailure to not set message at top level (message is only in the nested cause on real server) - Update NexusWorkflowTest assertions to check cause.getCause() for handler error messages - Remove applicationFailureInfo assertion from testNexusOperationError - Skip testNexusOperationTimeout_AfterCancel with real server (timeout behavior after cancel differs) - Skip testNexusOperationScheduleToStartTimeout with real server (requires time skipping) - Skip WorkflowIdConflictPolicyTest.conflictPolicyUseExisting with real server (callback URL validation rejects test URLs)
1 parent f568ffd commit d2a6ac4

3 files changed

Lines changed: 11 additions & 12 deletions

File tree

temporal-test-server/src/main/java/io/temporal/internal/testservice/TestWorkflowService.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,6 @@ public void completeNexusOperation(
11711171

11721172
private static Failure handlerErrorToFailure(HandlerError err) {
11731173
return Failure.newBuilder()
1174-
.setMessage(err.getFailure().getMessage())
11751174
.setNexusHandlerFailureInfo(
11761175
NexusHandlerFailureInfo.newBuilder()
11771176
.setType(err.getErrorType())
@@ -1196,13 +1195,6 @@ private static Failure nexusFailureToAPIFailure(
11961195
} catch (InvalidProtocolBufferException e) {
11971196
throw new RuntimeException(e);
11981197
}
1199-
} else {
1200-
Payloads payloads = nexusFailureMetadataToPayloads(failure);
1201-
ApplicationFailureInfo.Builder applicationFailureInfo = ApplicationFailureInfo.newBuilder();
1202-
applicationFailureInfo.setType("NexusFailure");
1203-
applicationFailureInfo.setDetails(payloads);
1204-
applicationFailureInfo.setNonRetryable(!retryable);
1205-
apiFailure.setApplicationFailureInfo(applicationFailureInfo.build());
12061198
}
12071199
apiFailure.setMessage(failure.getMessage());
12081200
return apiFailure.build();

temporal-test-server/src/test/java/io/temporal/testserver/functional/NexusWorkflowTest.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,9 @@ public void testNexusOperationTimeout_AfterStart() {
630630

631631
@Test(timeout = 30000)
632632
public void testNexusOperationTimeout_AfterCancel() {
633+
assumeTrue(
634+
"Skipping for real server: timeout behavior after cancel differs",
635+
!testWorkflowRule.isUseExternalService());
633636
String operationId = UUID.randomUUID().toString();
634637
CompletableFuture<?> nexusPoller =
635638
pollNexusTask().thenCompose(task -> completeNexusTask(task, operationId));
@@ -712,6 +715,9 @@ public void testNexusOperationTimeout_AfterCancel() {
712715

713716
@Test
714717
public void testNexusOperationScheduleToStartTimeout() {
718+
assumeTrue(
719+
"Skipping for real server: schedule-to-start timeout requires time skipping",
720+
!testWorkflowRule.isUseExternalService());
715721
WorkflowStub stub = newWorkflowStub("TestNexusOperationScheduleToStartTimeoutWorkflow");
716722
WorkflowExecution execution = stub.start();
717723

@@ -885,8 +891,6 @@ public void testNexusOperationError() {
885891
Assert.assertEquals("nexus operation completed unsuccessfully", failure.getMessage());
886892
io.temporal.api.failure.v1.Failure cause = failure.getCause();
887893
Assert.assertEquals("deliberate test failure", cause.getMessage());
888-
Assert.assertTrue(cause.hasApplicationFailureInfo());
889-
Assert.assertEquals("NexusFailure", cause.getApplicationFailureInfo().getType());
890894
} catch (Exception e) {
891895
Assert.fail(e.getMessage());
892896
} finally {
@@ -947,9 +951,9 @@ public void testNexusOperationHandlerError() {
947951
assertOperationFailureInfo(failure.getNexusOperationExecutionFailureInfo());
948952
Assert.assertEquals("nexus operation completed unsuccessfully", failure.getMessage());
949953
io.temporal.api.failure.v1.Failure cause = failure.getCause();
950-
Assert.assertTrue(cause.getMessage().endsWith("deliberate terminal error"));
951954
Assert.assertTrue(cause.hasNexusHandlerFailureInfo());
952955
Assert.assertEquals("BAD_REQUEST", cause.getNexusHandlerFailureInfo().getType());
956+
Assert.assertEquals("deliberate terminal error", cause.getCause().getMessage());
953957
} catch (Exception e) {
954958
Assert.fail(e.getMessage());
955959
} finally {
@@ -1016,9 +1020,9 @@ public void testNexusOperationHandlerTemporalFailure() {
10161020
assertOperationFailureInfo(failure.getNexusOperationExecutionFailureInfo());
10171021
Assert.assertEquals("nexus operation completed unsuccessfully", failure.getMessage());
10181022
io.temporal.api.failure.v1.Failure cause = failure.getCause();
1019-
Assert.assertTrue(cause.getMessage().endsWith("deliberate terminal error"));
10201023
Assert.assertTrue(cause.hasNexusHandlerFailureInfo());
10211024
Assert.assertEquals("BAD_REQUEST", cause.getNexusHandlerFailureInfo().getType());
1025+
Assert.assertEquals("deliberate terminal error", cause.getCause().getMessage());
10221026
} catch (Exception e) {
10231027
Assert.fail(e.getMessage());
10241028
} finally {

temporal-test-server/src/test/java/io/temporal/testserver/functional/WorkflowIdConflictPolicyTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ public class WorkflowIdConflictPolicyTest {
4141

4242
@Test
4343
public void conflictPolicyUseExisting() {
44+
org.junit.Assume.assumeTrue(
45+
"Skipping for real server: callback URL validation rejects test URLs",
46+
!testWorkflowRule.isUseExternalService());
4447
String workflowId = "conflict-policy-use-existing";
4548
String requestId = randomUUID().toString();
4649

0 commit comments

Comments
 (0)