Skip to content

Commit

Permalink
Make sure workflow options from proxy call are propagated (#2310)
Browse files Browse the repository at this point in the history
  • Loading branch information
Quinn-With-Two-Ns authored Nov 12, 2024
1 parent 24990db commit 83f47ef
Show file tree
Hide file tree
Showing 3 changed files with 200 additions and 159 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static WorkflowStub createNexusBoundStub(
}
WorkflowOptions options = stub.getOptions().get();
WorkflowOptions.Builder nexusWorkflowOptions =
WorkflowOptions.newBuilder()
WorkflowOptions.newBuilder(options)
.setRequestId(request.getRequestId())
.setCompletionCallbacks(
Arrays.asList(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
import org.junit.Test;

public class AsyncWorkflowOperationTest extends BaseNexusTest {
private static final String WORKFLOW_ID_PREFIX = "test-prefix";

@Rule
public SDKTestWorkflowRule testWorkflowRule =
SDKTestWorkflowRule.newBuilder()
Expand Down Expand Up @@ -86,6 +88,7 @@ public String execute(String input) {
Assert.assertTrue("Operation id should be present", asyncExec.getOperationId().isPresent());
// Result should only be completed if the operation is completed
Assert.assertFalse("Result should not be completed", asyncOpHandle.getResult().isCompleted());
Assert.assertTrue(asyncExec.getOperationId().get().startsWith(WORKFLOW_ID_PREFIX));
// Unblock the operation
Workflow.newExternalWorkflowStub(OperationWorkflow.class, asyncExec.getOperationId().get())
.unblock();
Expand Down Expand Up @@ -129,7 +132,9 @@ public OperationHandler<String, String> operation() {
(context, details, client, input) ->
client.newWorkflowStub(
OperationWorkflow.class,
WorkflowOptions.newBuilder().setWorkflowId(details.getRequestId()).build())
WorkflowOptions.newBuilder()
.setWorkflowId(WORKFLOW_ID_PREFIX + details.getRequestId())
.build())
::execute);
}
}
Expand Down
Loading

0 comments on commit 83f47ef

Please sign in to comment.