Skip to content

Commit 301e129

Browse files
Fix test server operation timeout (#2282)
1 parent ac3526b commit 301e129

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import io.temporal.workflow.*;
3131
import io.temporal.workflow.shared.TestNexusServices;
3232
import io.temporal.workflow.shared.TestWorkflows;
33-
import java.time.Duration;
3433
import org.junit.Assert;
3534
import org.junit.Rule;
3635
import org.junit.Test;
@@ -65,10 +64,7 @@ public void testWorkflowOperationReplay() throws Exception {
6564
public static class TestNexus implements TestWorkflows.TestWorkflow1 {
6665
@Override
6766
public String execute(String input) {
68-
NexusOperationOptions options =
69-
NexusOperationOptions.newBuilder()
70-
.setScheduleToCloseTimeout(Duration.ofSeconds(10))
71-
.build();
67+
NexusOperationOptions options = NexusOperationOptions.newBuilder().build();
7268
NexusServiceOptions serviceOptions =
7369
NexusServiceOptions.newBuilder()
7470
.setEndpoint(getEndpointName())

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,8 @@ private static void scheduleNexusOperation(
661661
long workflowTaskCompletedId) {
662662
Duration expirationInterval = attr.getScheduleToCloseTimeout();
663663
Timestamp expirationTime =
664-
(attr.hasScheduleToCloseTimeout())
664+
(attr.hasScheduleToCloseTimeout()
665+
&& Durations.toMillis(attr.getScheduleToCloseTimeout()) > 0)
665666
? Timestamps.add(ctx.currentTime(), expirationInterval)
666667
: Timestamp.getDefaultInstance();
667668
TestServiceRetryState retryState = new TestServiceRetryState(data.retryPolicy, expirationTime);

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,8 @@ private void processScheduleNexusOperation(
786786
timeoutNexusRequest(
787787
scheduleEventId, "StartNexusOperation", operation.getData().getAttempt()),
788788
"StartNexusOperation request timeout");
789-
if (attr.hasScheduleToCloseTimeout()) {
789+
if (attr.hasScheduleToCloseTimeout()
790+
&& Durations.toMillis(attr.getScheduleToCloseTimeout()) > 0) {
790791
ctx.addTimer(
791792
ProtobufTimeUtils.toJavaDuration(attr.getScheduleToCloseTimeout()),
792793
() ->

0 commit comments

Comments
 (0)