From eb1f2c0e52571f6379f58c96337ccc1ce2e97fcf Mon Sep 17 00:00:00 2001 From: sdk-sentinel-bot Date: Fri, 28 Aug 2026 03:09:08 +0000 Subject: [PATCH] Isolate Nexus cancellation test signals --- .../nexus/CancelWorkflowAsyncOperationTest.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/temporal-sdk/src/test/java/io/temporal/workflow/nexus/CancelWorkflowAsyncOperationTest.java b/temporal-sdk/src/test/java/io/temporal/workflow/nexus/CancelWorkflowAsyncOperationTest.java index 3c9f1b8719..d2d390e77f 100644 --- a/temporal-sdk/src/test/java/io/temporal/workflow/nexus/CancelWorkflowAsyncOperationTest.java +++ b/temporal-sdk/src/test/java/io/temporal/workflow/nexus/CancelWorkflowAsyncOperationTest.java @@ -135,11 +135,6 @@ public void cancelAsyncOperationAbandon() { // Cancel before command is sent runCancelBeforeSentTest(NexusOperationCancellationType.ABANDON); - // For ABANDON, the handler workflow may start even in the cancel-before-sent case, - // which can set opStarted and handlerFinished. Clear them before the after-start test. - opStarted.clearSignal(); - handlerFinished.clearSignal(); - // Cancel after operation is started WorkflowStub stub = testWorkflowRule.newUntypedWorkflowStubTimeoutOptions("TestNexusOperationCancellationType"); @@ -240,13 +235,16 @@ public void execute( TestNexusService serviceStub = Workflow.newNexusServiceStub(TestNexusService.class, serviceOptions); + long finishDelay = cancelImmediately ? 0L : 2000L; NexusOperationHandle handle = - Workflow.startNexusOperation(serviceStub::operation, 2000L); + Workflow.startNexusOperation(serviceStub::operation, finishDelay); if (cancelImmediately) { CancellationScope.current().cancel(); } handle.getExecution().get(); - opStarted.signal(); + if (!cancelImmediately) { + opStarted.signal(); + } // Wait to receive request to cancel, then block until operation result promise is ready. try {