From 5714ad8bac38136c8a57cb1e821a256b7be21ffd Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Thu, 5 Dec 2024 09:40:00 -0500 Subject: [PATCH] Rename field --- internal/internal_workflow_client.go | 6 ++-- internal/internal_workflow_client_test.go | 14 ++++---- test/integration_test.go | 40 +++++++++++------------ 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/internal/internal_workflow_client.go b/internal/internal_workflow_client.go index 78e0cd95e..eb7050a72 100644 --- a/internal/internal_workflow_client.go +++ b/internal/internal_workflow_client.go @@ -807,8 +807,8 @@ type UpdateWorkflowOptions struct { // See [UpdateWithStartWorkflow]. // NOTE: Experimental type UpdateWithStartWorkflowOptions struct { - StartOperation WithStartWorkflowOperation - UpdateOptions UpdateWorkflowOptions + StartWorkflowOperation WithStartWorkflowOperation + UpdateOptions UpdateWorkflowOptions } // WorkflowUpdateHandle is a handle to a workflow execution update process. The @@ -1190,7 +1190,7 @@ func (wc *WorkflowClient) UpdateWithStartWorkflow( ctx context.Context, options UpdateWithStartWorkflowOptions, ) (WorkflowUpdateHandle, error) { - startOp, ok := options.StartOperation.(*withStartWorkflowOperationImpl) + startOp, ok := options.StartWorkflowOperation.(*withStartWorkflowOperationImpl) if !ok { return nil, fmt.Errorf("%w: startOperation must be created by NewWithStartWorkflowOperation", errInvalidWithStartWorkflowOperation) } diff --git a/internal/internal_workflow_client_test.go b/internal/internal_workflow_client_test.go index 85b1b48cd..f7b52abc4 100644 --- a/internal/internal_workflow_client_test.go +++ b/internal/internal_workflow_client_test.go @@ -1025,7 +1025,7 @@ func (s *workflowRunSuite) TestExecuteWorkflowWithUpdate_Retry() { UpdateName: "update", WaitForStage: WorkflowUpdateStageCompleted, }, - StartOperation: startOp, + StartWorkflowOperation: startOp, }, ) s.NoError(err) @@ -1102,7 +1102,7 @@ func (s *workflowRunSuite) TestExecuteWorkflowWithUpdate_Abort() { UpdateName: "update", WaitForStage: WorkflowUpdateStageCompleted, }, - StartOperation: startOp, + StartWorkflowOperation: startOp, }, ) @@ -1133,7 +1133,7 @@ func (s *workflowRunSuite) TestExecuteWorkflowWithUpdate_NonMultiOperationError( UpdateName: "update", WaitForStage: WorkflowUpdateStageCompleted, }, - StartOperation: startOp, + StartWorkflowOperation: startOp, }, ) s.ErrorContains(err, "internal error") @@ -1161,7 +1161,7 @@ func (s *workflowRunSuite) TestExecuteWorkflowWithUpdate_ServerResponseCountMism UpdateName: "update", WaitForStage: WorkflowUpdateStageCompleted, }, - StartOperation: startOp, + StartWorkflowOperation: startOp, }, ) s.ErrorContains(err, "invalid server response: 0 instead of 2 operation results") @@ -1187,7 +1187,7 @@ func (s *workflowRunSuite) TestExecuteWorkflowWithUpdate_ServerErrorResponseCoun UpdateName: "update", WaitForStage: WorkflowUpdateStageCompleted, }, - StartOperation: startOp, + StartWorkflowOperation: startOp, }, ) s.ErrorContains(err, "invalid server response: 0 instead of 2 operation errors") @@ -1220,7 +1220,7 @@ func (s *workflowRunSuite) TestExecuteWorkflowWithUpdate_ServerStartResponseType UpdateName: "update", WaitForStage: WorkflowUpdateStageCompleted, }, - StartOperation: startOp, + StartWorkflowOperation: startOp, }, ) s.ErrorContains(err, "invalid server response: StartWorkflow response has the wrong type *workflowservice.ExecuteMultiOperationResponse_Response_UpdateWorkflow") @@ -1259,7 +1259,7 @@ func (s *workflowRunSuite) TestExecuteWorkflowWithUpdate_ServerUpdateResponseTyp UpdateName: "update", WaitForStage: WorkflowUpdateStageCompleted, }, - StartOperation: startOp, + StartWorkflowOperation: startOp, }, ) s.ErrorContains(err, "invalid server response: UpdateWorkflow response has the wrong type *workflowservice.ExecuteMultiOperationResponse_Response_StartWorkflow") diff --git a/test/integration_test.go b/test/integration_test.go index fb2b05525..1cc9129fb 100644 --- a/test/integration_test.go +++ b/test/integration_test.go @@ -2577,7 +2577,7 @@ func (ts *IntegrationTestSuite) testOpenTelemetryTracing(withMessages bool, upda UpdateName: "workflow-update", WaitForStage: client.WorkflowUpdateStageCompleted, }, - StartOperation: startOp, + StartWorkflowOperation: startOp, }) ts.NoError(err) ts.NoError(updateHandle.Get(ctx, nil)) @@ -4031,7 +4031,7 @@ func (ts *IntegrationTestSuite) TestUpdateWithStartWorkflow() { Args: []any{1}, WaitForStage: client.WorkflowUpdateStageAccepted, }, - StartOperation: startOp, + StartWorkflowOperation: startOp, }) ts.NoError(err) @@ -4062,7 +4062,7 @@ func (ts *IntegrationTestSuite) TestUpdateWithStartWorkflow() { Args: []any{1}, WaitForStage: client.WorkflowUpdateStageCompleted, }, - StartOperation: startOp, + StartWorkflowOperation: startOp, }) ts.NoError(err) @@ -4084,7 +4084,7 @@ func (ts *IntegrationTestSuite) TestUpdateWithStartWorkflow() { Args: []any{-1}, // rejected update payload WaitForStage: client.WorkflowUpdateStageCompleted, }, - StartOperation: startOp, + StartWorkflowOperation: startOp, }) ts.NoError(err) @@ -4116,7 +4116,7 @@ func (ts *IntegrationTestSuite) TestUpdateWithStartWorkflow() { Args: []any{1}, WaitForStage: client.WorkflowUpdateStageAccepted, }, - StartOperation: startOp, + StartWorkflowOperation: startOp, }) ts.NoError(err) @@ -4144,16 +4144,16 @@ func (ts *IntegrationTestSuite) TestUpdateWithStartWorkflow() { startOptions.CronSchedule = "invalid!" startOp := ts.client.NewWithStartWorkflowOperation(startOptions, ts.workflows.UpdateEntityWorkflow) _, err := ts.client.UpdateWithStartWorkflow(ctx, client.UpdateWithStartWorkflowOptions{ - UpdateOptions: updateOptions, - StartOperation: startOp, + UpdateOptions: updateOptions, + StartWorkflowOperation: startOp, }) ts.Error(err) startOptions.WorkflowIDConflictPolicy = enumspb.WORKFLOW_ID_CONFLICT_POLICY_UNSPECIFIED startOp = ts.client.NewWithStartWorkflowOperation(startOptions, ts.workflows.UpdateEntityWorkflow) _, err = ts.client.UpdateWithStartWorkflow(ctx, client.UpdateWithStartWorkflowOptions{ - UpdateOptions: updateOptions, - StartOperation: startOp, + UpdateOptions: updateOptions, + StartWorkflowOperation: startOp, }) ts.ErrorContains(err, "WorkflowIDConflictPolicy must be set") }) @@ -4167,7 +4167,7 @@ func (ts *IntegrationTestSuite) TestUpdateWithStartWorkflow() { UpdateOptions: client.UpdateWorkflowOptions{ // invalid }, - StartOperation: startOp, + StartWorkflowOperation: startOp, }) ts.ErrorContains(err, "WaitForStage must be specified") @@ -4176,7 +4176,7 @@ func (ts *IntegrationTestSuite) TestUpdateWithStartWorkflow() { RunID: "invalid", WaitForStage: client.WorkflowUpdateStageCompleted, }, - StartOperation: startOp, + StartWorkflowOperation: startOp, }) ts.ErrorContains(err, "invalid UpdateWorkflowOptions: RunID cannot be set for UpdateWithStartWorkflow because the workflow might not be running") @@ -4185,7 +4185,7 @@ func (ts *IntegrationTestSuite) TestUpdateWithStartWorkflow() { FirstExecutionRunID: "invalid", WaitForStage: client.WorkflowUpdateStageCompleted, }, - StartOperation: startOp, + StartWorkflowOperation: startOp, }) ts.ErrorContains(err, "invalid UpdateWorkflowOptions: FirstExecutionRunID cannot be set for UpdateWithStartWorkflow because the workflow might not be running") @@ -4194,7 +4194,7 @@ func (ts *IntegrationTestSuite) TestUpdateWithStartWorkflow() { UpdateName: "", // invalid WaitForStage: client.WorkflowUpdateStageCompleted, }, - StartOperation: startOp, + StartWorkflowOperation: startOp, }) ts.ErrorContains(err, "invalid WithStartWorkflowOperation: ") // omitting server message intentionally @@ -4204,7 +4204,7 @@ func (ts *IntegrationTestSuite) TestUpdateWithStartWorkflow() { UpdateName: "update", WaitForStage: client.WorkflowUpdateStageCompleted, }, - StartOperation: startOp, + StartWorkflowOperation: startOp, }) ts.ErrorContains(err, "invalid WithStartWorkflowOperation: ") // omitting server message intentionally }) @@ -4221,7 +4221,7 @@ func (ts *IntegrationTestSuite) TestUpdateWithStartWorkflow() { Args: []any{1}, WaitForStage: client.WorkflowUpdateStageCompleted, }, - StartOperation: startOp, + StartWorkflowOperation: startOp, }) // NOTE that WorkflowExecutionErrorWhenAlreadyStarted (defaults to false) has no impact @@ -4237,14 +4237,14 @@ func (ts *IntegrationTestSuite) TestUpdateWithStartWorkflow() { WaitForStage: client.WorkflowUpdateStageCompleted, } _, err := ts.client.UpdateWithStartWorkflow(ctx, client.UpdateWithStartWorkflowOptions{ - UpdateOptions: updateOptions, - StartOperation: startOp, + UpdateOptions: updateOptions, + StartWorkflowOperation: startOp, }) ts.NoError(err) _, err = ts.client.UpdateWithStartWorkflow(ctx, client.UpdateWithStartWorkflowOptions{ - UpdateOptions: updateOptions, - StartOperation: startOp, + UpdateOptions: updateOptions, + StartWorkflowOperation: startOp, }) ts.ErrorContains(err, "invalid WithStartWorkflowOperation: was already executed") }) @@ -4264,7 +4264,7 @@ func (ts *IntegrationTestSuite) TestUpdateWithStartWorkflow() { Args: []any{1}, WaitForStage: client.WorkflowUpdateStageCompleted, }, - StartOperation: startOp, + StartWorkflowOperation: startOp, }) ts.NoError(err)