Skip to content

Commit 3d44cf5

Browse files
Fix some CI failures
1 parent 3495885 commit 3d44cf5

9 files changed

Lines changed: 35 additions & 59 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272

7373
- name: Start containerized server and dependencies
7474
env:
75-
TEMPORAL_CLI_VERSION: v1.6.1-server-1.31.0-151.0
75+
TEMPORAL_CLI_VERSION: 1.6.1-server-1.31.0-151.0
7676
run: |
7777
wget -O temporal_cli.tar.gz https://github.com/temporalio/cli/releases/download/v${TEMPORAL_CLI_VERSION}/temporal_cli_${TEMPORAL_CLI_VERSION}_linux_amd64.tar.gz
7878
tar -xzf temporal_cli.tar.gz

temporal-sdk/src/main/java/io/temporal/internal/nexus/NexusTaskHandlerImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ private void convertKnownFailures(Throwable e) {
193193
if (((ApplicationFailure) failure).isNonRetryable()) {
194194
throw new HandlerException(
195195
HandlerException.ErrorType.INTERNAL,
196+
"Handler failed with non-retryable application error",
196197
failure,
197198
HandlerException.RetryBehavior.NON_RETRYABLE);
198199
}

temporal-sdk/src/main/java/io/temporal/internal/nexus/TemporalInterceptorMiddleware.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package io.temporal.internal.nexus;
22

33
import io.nexusrpc.OperationException;
4-
import io.nexusrpc.OperationInfo;
54
import io.nexusrpc.handler.*;
65
import io.temporal.common.interceptors.NexusOperationInboundCallsInterceptor;
76
import io.temporal.common.interceptors.WorkerInterceptor;
@@ -51,20 +50,6 @@ public OperationStartResult<Object> start(
5150
.getResult();
5251
}
5352

54-
@Override
55-
public Object fetchResult(
56-
OperationContext operationContext, OperationFetchResultDetails operationFetchResultDetails)
57-
throws OperationException {
58-
throw new UnsupportedOperationException("Not implemented");
59-
}
60-
61-
@Override
62-
public OperationInfo fetchInfo(
63-
OperationContext operationContext, OperationFetchInfoDetails operationFetchInfoDetails)
64-
throws HandlerException {
65-
throw new UnsupportedOperationException("Not implemented");
66-
}
67-
6853
@Override
6954
public void cancel(
7055
OperationContext operationContext, OperationCancelDetails operationCancelDetails) {

temporal-sdk/src/main/java/io/temporal/nexus/WorkflowRunOperationImpl.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import static io.temporal.internal.common.LinkConverter.workflowEventToNexusLink;
44
import static io.temporal.internal.common.NexusUtil.nexusProtoLinkToLink;
55

6-
import io.nexusrpc.OperationInfo;
76
import io.nexusrpc.handler.*;
87
import io.nexusrpc.handler.OperationHandler;
98
import io.temporal.api.common.v1.Link;
@@ -77,18 +76,6 @@ public OperationStartResult<R> start(
7776
return result.build();
7877
}
7978

80-
@Override
81-
public R fetchResult(
82-
OperationContext operationContext, OperationFetchResultDetails operationFetchResultDetails) {
83-
throw new UnsupportedOperationException("Not implemented");
84-
}
85-
86-
@Override
87-
public OperationInfo fetchInfo(
88-
OperationContext operationContext, OperationFetchInfoDetails operationFetchInfoDetails) {
89-
throw new UnsupportedOperationException("Not implemented");
90-
}
91-
9279
@Override
9380
public void cancel(
9481
OperationContext operationContext, OperationCancelDetails operationCancelDetails) {

temporal-sdk/src/test/java/io/temporal/internal/nexus/NexusTaskHandlerImplTest.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
import com.uber.m3.tally.Scope;
88
import com.uber.m3.util.Duration;
99
import io.nexusrpc.Header;
10-
import io.nexusrpc.OperationInfo;
11-
import io.nexusrpc.OperationStillRunningException;
1210
import io.nexusrpc.handler.*;
1311
import io.temporal.api.common.v1.Payload;
1412
import io.temporal.api.nexus.v1.Request;
@@ -204,17 +202,6 @@ public OperationStartResult<String> start(
204202
return OperationStartResult.async(id);
205203
}
206204

207-
@Override
208-
public String fetchResult(OperationContext context, OperationFetchResultDetails details)
209-
throws OperationStillRunningException {
210-
throw new UnsupportedOperationException("Not implemented");
211-
}
212-
213-
@Override
214-
public OperationInfo fetchInfo(OperationContext context, OperationFetchInfoDetails details) {
215-
throw new UnsupportedOperationException("Not implemented");
216-
}
217-
218205
@Override
219206
public void cancel(OperationContext context, OperationCancelDetails details) {
220207
throw new UnsupportedOperationException("Not implemented");

temporal-sdk/src/test/java/io/temporal/workflow/nexus/OperationFailMetricTest.java

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import io.temporal.failure.ApplicationFailure;
1717
import io.temporal.failure.CanceledFailure;
1818
import io.temporal.failure.NexusOperationFailure;
19+
import io.temporal.failure.TemporalFailure;
1920
import io.temporal.serviceclient.MetricsTag;
2021
import io.temporal.testUtils.Eventually;
2122
import io.temporal.testing.internal.SDKTestWorkflowRule;
@@ -90,6 +91,12 @@ public void failOperationMetrics() {
9091
assertNoRetries("fail");
9192
ApplicationFailure applicationFailure =
9293
assertNexusOperationFailure(ApplicationFailure.class, workflowException);
94+
if (isUsingNewFormat()) {
95+
Assert.assertEquals(
96+
"java.lang.RuntimeException: intentional failure",
97+
applicationFailure.getOriginalMessage());
98+
applicationFailure = (ApplicationFailure) applicationFailure.getCause();
99+
}
93100
Assert.assertEquals("intentional failure", applicationFailure.getOriginalMessage());
94101

95102
Map<String, String> execFailedTags =
@@ -117,14 +124,15 @@ public void cancelOperationMetrics() {
117124
assertNoRetries("cancel");
118125
CanceledFailure canceledFailure =
119126
assertNexusOperationFailure(CanceledFailure.class, workflowException);
120-
Assert.assertEquals("intentional cancel", canceledFailure.getOriginalMessage());
121-
// TODO assert stack trace
127+
TemporalFailure temporalFailure = canceledFailure;
122128
if (isUsingNewFormat()) {
129+
Assert.assertEquals(
130+
"java.lang.RuntimeException: intentional cancel", temporalFailure.getOriginalMessage());
123131
Assert.assertNotNull(canceledFailure.getCause());
124132
Assert.assertTrue(canceledFailure.getCause() instanceof ApplicationFailure);
125-
ApplicationFailure applicationFailure = (ApplicationFailure) canceledFailure.getCause();
126-
Assert.assertEquals("intentional cancel", applicationFailure.getOriginalMessage());
133+
temporalFailure = (TemporalFailure) temporalFailure.getCause();
127134
}
135+
Assert.assertEquals("intentional cancel", temporalFailure.getOriginalMessage());
128136

129137
Map<String, String> execFailedTags =
130138
getOperationTags()
@@ -155,7 +163,7 @@ public void failOperationApplicationErrorMetrics() {
155163
assertNexusOperationFailure(ApplicationFailure.class, workflowException);
156164
if (isUsingNewFormat()) {
157165
Assert.assertEquals(
158-
"message='intentional failure', type='TestFailure', nonRetryable=false",
166+
"io.temporal.failure.ApplicationFailure: message='intentional failure', type='TestFailure', nonRetryable=false",
159167
applicationFailure.getOriginalMessage());
160168
Assert.assertEquals("OperationError", applicationFailure.getType());
161169
Assert.assertNotNull(applicationFailure.getCause());
@@ -191,10 +199,9 @@ public void cancelOperationApplicationErrorMetrics() {
191199
assertNoRetries("cancel-app");
192200
CanceledFailure canceledFailure =
193201
assertNexusOperationFailure(CanceledFailure.class, workflowException);
194-
//
195202
if (isUsingNewFormat()) {
196203
Assert.assertEquals(
197-
"message='intentional cancel', type='TestFailure', nonRetryable=false",
204+
"io.temporal.failure.ApplicationFailure: message='intentional cancel', type='TestFailure', nonRetryable=false",
198205
canceledFailure.getOriginalMessage());
199206
Assert.assertEquals(0, canceledFailure.getDetails().getSize());
200207
Assert.assertNotNull(canceledFailure.getCause());
@@ -469,10 +476,18 @@ public void failHandlerNonRetryableApplicationFailureMetrics() {
469476
assertNexusOperationFailure(HandlerException.class, workflowException);
470477
assertNoRetries("non-retryable-application-failure");
471478

472-
Assert.assertTrue(handlerFailure.getMessage().contains("intentional failure"));
473-
Assert.assertEquals(HandlerException.ErrorType.INTERNAL, handlerFailure.getErrorType());
474-
Assert.assertEquals(
475-
HandlerException.RetryBehavior.NON_RETRYABLE, handlerFailure.getRetryBehavior());
479+
Exception failure = handlerFailure;
480+
if (isUsingNewFormat()) {
481+
Assert.assertEquals(
482+
"Handler failed with non-retryable application error", handlerFailure.getMessage());
483+
Assert.assertEquals(HandlerException.ErrorType.INTERNAL, handlerFailure.getErrorType());
484+
Assert.assertEquals(
485+
HandlerException.RetryBehavior.NON_RETRYABLE, handlerFailure.getRetryBehavior());
486+
Assert.assertNotNull(failure.getCause());
487+
failure = (Exception) failure.getCause();
488+
}
489+
490+
Assert.assertTrue(failure.getMessage().contains("intentional failure"));
476491

477492
Map<String, String> execFailedTags =
478493
getOperationTags()
@@ -621,7 +636,8 @@ public OperationHandler<String, String> operation() {
621636
"failure message",
622637
ApplicationFailure.newFailure("intentional cancel", "TestFailure", "foo"));
623638
case "handlererror":
624-
throw new HandlerException(HandlerException.ErrorType.BAD_REQUEST, "handlererror");
639+
throw new HandlerException(
640+
HandlerException.ErrorType.BAD_REQUEST, new RuntimeException("handlererror"));
625641
case "handlererror-app":
626642
throw new HandlerException(
627643
HandlerException.ErrorType.BAD_REQUEST,

temporal-sdk/src/test/java/io/temporal/workflow/nexus/OperationFailureConversionTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ public void nexusOperationApplicationFailureNonRetryableFailureConversion() {
4141
NexusOperationFailure nexusFailure = (NexusOperationFailure) exception.getCause();
4242
Assert.assertTrue(nexusFailure.getCause() instanceof HandlerException);
4343
HandlerException handlerException = (HandlerException) nexusFailure.getCause();
44-
Assert.assertTrue(handlerException.getMessage().contains("failed to call operation"));
4544
Assert.assertEquals(HandlerException.ErrorType.INTERNAL, handlerException.getErrorType());
45+
Assert.assertTrue(
46+
handlerException.getCause().getMessage().contains("failed to call operation"));
4647
}
4748

4849
@Test
@@ -56,8 +57,8 @@ public void nexusOperationApplicationFailureFailureConversion() {
5657
NexusOperationFailure nexusFailure = (NexusOperationFailure) exception.getCause();
5758
Assert.assertTrue(nexusFailure.getCause() instanceof HandlerException);
5859
HandlerException handlerFailure = (HandlerException) nexusFailure.getCause();
59-
Assert.assertTrue(handlerFailure.getMessage().contains("exceeded invocation count"));
6060
Assert.assertEquals(HandlerException.ErrorType.INTERNAL, handlerFailure.getErrorType());
61+
Assert.assertTrue(handlerFailure.getCause().getMessage().contains("exceeded invocation count"));
6162
}
6263

6364
@Test

temporal-sdk/src/test/java/io/temporal/workflow/nexus/SyncOperationCancelledTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ public OperationHandler<String, String> operation() {
8888
return OperationHandler.sync(
8989
(ctx, details, input) -> {
9090
if (input.equals("cancel-in-handler")) {
91-
throw OperationException.canceled(
92-
new RuntimeException("operation canceled in handler"));
91+
throw OperationException.canceled("operation canceled in handler");
9392
}
9493
throw new RuntimeException("failed to call operation");
9594
});

temporal-sdk/src/test/java/io/temporal/workflow/nexus/SyncOperationFailTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public OperationHandler<String, String> operation() {
133133
// Implemented inline
134134
return OperationHandler.sync(
135135
(ctx, details, name) -> {
136-
throw OperationException.failure(new RuntimeException("failed to call operation"));
136+
throw OperationException.failure("failed to call operation");
137137
});
138138
}
139139
}

0 commit comments

Comments
 (0)