Skip to content

Commit

Permalink
Rename field
Browse files Browse the repository at this point in the history
  • Loading branch information
dandavison committed Dec 5, 2024
1 parent 4466f9d commit 5714ad8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
6 changes: 3 additions & 3 deletions internal/internal_workflow_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
Expand Down
14 changes: 7 additions & 7 deletions internal/internal_workflow_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ func (s *workflowRunSuite) TestExecuteWorkflowWithUpdate_Retry() {
UpdateName: "update",
WaitForStage: WorkflowUpdateStageCompleted,
},
StartOperation: startOp,
StartWorkflowOperation: startOp,
},
)
s.NoError(err)
Expand Down Expand Up @@ -1102,7 +1102,7 @@ func (s *workflowRunSuite) TestExecuteWorkflowWithUpdate_Abort() {
UpdateName: "update",
WaitForStage: WorkflowUpdateStageCompleted,
},
StartOperation: startOp,
StartWorkflowOperation: startOp,
},
)

Expand Down Expand Up @@ -1133,7 +1133,7 @@ func (s *workflowRunSuite) TestExecuteWorkflowWithUpdate_NonMultiOperationError(
UpdateName: "update",
WaitForStage: WorkflowUpdateStageCompleted,
},
StartOperation: startOp,
StartWorkflowOperation: startOp,
},
)
s.ErrorContains(err, "internal error")
Expand Down Expand Up @@ -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")
Expand All @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down
40 changes: 20 additions & 20 deletions test/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -4031,7 +4031,7 @@ func (ts *IntegrationTestSuite) TestUpdateWithStartWorkflow() {
Args: []any{1},
WaitForStage: client.WorkflowUpdateStageAccepted,
},
StartOperation: startOp,
StartWorkflowOperation: startOp,
})
ts.NoError(err)

Expand Down Expand Up @@ -4062,7 +4062,7 @@ func (ts *IntegrationTestSuite) TestUpdateWithStartWorkflow() {
Args: []any{1},
WaitForStage: client.WorkflowUpdateStageCompleted,
},
StartOperation: startOp,
StartWorkflowOperation: startOp,
})
ts.NoError(err)

Expand All @@ -4084,7 +4084,7 @@ func (ts *IntegrationTestSuite) TestUpdateWithStartWorkflow() {
Args: []any{-1}, // rejected update payload
WaitForStage: client.WorkflowUpdateStageCompleted,
},
StartOperation: startOp,
StartWorkflowOperation: startOp,
})
ts.NoError(err)

Expand Down Expand Up @@ -4116,7 +4116,7 @@ func (ts *IntegrationTestSuite) TestUpdateWithStartWorkflow() {
Args: []any{1},
WaitForStage: client.WorkflowUpdateStageAccepted,
},
StartOperation: startOp,
StartWorkflowOperation: startOp,
})
ts.NoError(err)

Expand Down Expand Up @@ -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")
})
Expand All @@ -4167,7 +4167,7 @@ func (ts *IntegrationTestSuite) TestUpdateWithStartWorkflow() {
UpdateOptions: client.UpdateWorkflowOptions{
// invalid
},
StartOperation: startOp,
StartWorkflowOperation: startOp,
})
ts.ErrorContains(err, "WaitForStage must be specified")

Expand All @@ -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")

Expand All @@ -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")

Expand All @@ -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

Expand All @@ -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
})
Expand All @@ -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
Expand All @@ -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")
})
Expand All @@ -4264,7 +4264,7 @@ func (ts *IntegrationTestSuite) TestUpdateWithStartWorkflow() {
Args: []any{1},
WaitForStage: client.WorkflowUpdateStageCompleted,
},
StartOperation: startOp,
StartWorkflowOperation: startOp,
})
ts.NoError(err)

Expand Down

0 comments on commit 5714ad8

Please sign in to comment.