diff --git a/evictiontest/workflow_cache_eviction_test.go b/evictiontest/workflow_cache_eviction_test.go index a76f4c4f1..c0320b8b9 100644 --- a/evictiontest/workflow_cache_eviction_test.go +++ b/evictiontest/workflow_cache_eviction_test.go @@ -95,14 +95,14 @@ func TestWorkersTestSuite(t *testing.T) { func createTestEventWorkflowExecutionStarted(eventID int64, attr *eventpb.WorkflowExecutionStartedEventAttributes) *eventpb.HistoryEvent { return &eventpb.HistoryEvent{ EventId: eventID, - EventType: eventpb.EventType_WorkflowExecutionStarted, + EventType: eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_STARTED, Attributes: &eventpb.HistoryEvent_WorkflowExecutionStartedEventAttributes{WorkflowExecutionStartedEventAttributes: attr}} } func createTestEventDecisionTaskScheduled(eventID int64, attr *eventpb.DecisionTaskScheduledEventAttributes) *eventpb.HistoryEvent { return &eventpb.HistoryEvent{ EventId: eventID, - EventType: eventpb.EventType_DecisionTaskScheduled, + EventType: eventpb.EVENT_TYPE_DECISION_TASK_SCHEDULED, Attributes: &eventpb.HistoryEvent_DecisionTaskScheduledEventAttributes{DecisionTaskScheduledEventAttributes: attr}} } diff --git a/go.mod b/go.mod index 71ecb4f04..dd4c30569 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/uber-go/tally v3.3.17+incompatible github.com/uber/jaeger-client-go v2.23.1+incompatible github.com/uber/jaeger-lib v2.2.0+incompatible // indirect - go.temporal.io/temporal-proto v0.23.5 + go.temporal.io/temporal-proto v0.23.6 go.uber.org/atomic v1.6.0 go.uber.org/goleak v1.0.0 go.uber.org/zap v1.15.0 diff --git a/go.sum b/go.sum index a5d3be341..9235144d5 100644 --- a/go.sum +++ b/go.sum @@ -99,8 +99,8 @@ github.com/uber/jaeger-client-go v2.23.1+incompatible/go.mod h1:WVhlPFC8FDjOFMMW github.com/uber/jaeger-lib v2.2.0+incompatible h1:MxZXOiR2JuoANZ3J6DE/U0kSFv/eJ/GfSYVCjK7dyaw= github.com/uber/jaeger-lib v2.2.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.temporal.io/temporal-proto v0.23.5 h1:xJzulgFaaO5UvpkxeKRweZmOunLqqSS5QP103AG6GBQ= -go.temporal.io/temporal-proto v0.23.5/go.mod h1:U85R39c1zPKnKMJ/QXk6KC21Y3R9j7FUIhUwzxxMY+Y= +go.temporal.io/temporal-proto v0.23.6 h1:MHUDqJB2nptBSjZcDZMt/vv1rC8L0grTvwoRYHJwAG0= +go.temporal.io/temporal-proto v0.23.6/go.mod h1:lFt53MEhtjHIJtgg1U1Fdx3e3HoBOZcZKEbElzYz5Ro= go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/goleak v1.0.0 h1:qsup4IcBdlmsnGfqyLl4Ntn3C2XCCuKAE7DwHpScyUo= @@ -184,8 +184,8 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200605102947-12044bf5ea91 h1:ES+5k7Xz+sYByd2L7mvcanaIuY0Iz3L3O6OhN+cRdu8= -google.golang.org/genproto v0.0.0-20200605102947-12044bf5ea91/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200608115520-7c474a2e3482 h1:i+Aiej6cta/Frzp13/swvwz5O00kYcSe0A/C5Wd7zX8= +google.golang.org/genproto v0.0.0-20200608115520-7c474a2e3482/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= diff --git a/internal/client.go b/internal/client.go index 913b41c41..a4f7e55ef 100644 --- a/internal/client.go +++ b/internal/client.go @@ -643,11 +643,11 @@ func newNamespaceServiceClient(workflowServiceClient workflowservice.WorkflowSer func (p WorkflowIDReusePolicy) toProto() commonpb.WorkflowIdReusePolicy { switch p { case WorkflowIDReusePolicyAllowDuplicate: - return commonpb.WorkflowIdReusePolicy_AllowDuplicate + return commonpb.WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE case WorkflowIDReusePolicyAllowDuplicateFailedOnly: - return commonpb.WorkflowIdReusePolicy_AllowDuplicateFailedOnly + return commonpb.WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY case WorkflowIDReusePolicyRejectDuplicate: - return commonpb.WorkflowIdReusePolicy_RejectDuplicate + return commonpb.WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE default: panic(fmt.Sprintf("unknown workflow reuse policy %v", p)) } @@ -656,11 +656,11 @@ func (p WorkflowIDReusePolicy) toProto() commonpb.WorkflowIdReusePolicy { func (p ParentClosePolicy) toProto() commonpb.ParentClosePolicy { switch p { case ParentClosePolicyAbandon: - return commonpb.ParentClosePolicy_Abandon + return commonpb.PARENT_CLOSE_POLICY_ABANDON case ParentClosePolicyRequestCancel: - return commonpb.ParentClosePolicy_RequestCancel + return commonpb.PARENT_CLOSE_POLICY_REQUEST_CANCEL case ParentClosePolicyTerminate: - return commonpb.ParentClosePolicy_Terminate + return commonpb.PARENT_CLOSE_POLICY_TERMINATE default: panic(fmt.Sprintf("unknown workflow parent close policy %v", p)) } diff --git a/internal/common/serializer/serializer.go b/internal/common/serializer/serializer.go index 4b02f2355..318cffdc8 100644 --- a/internal/common/serializer/serializer.go +++ b/internal/common/serializer/serializer.go @@ -86,10 +86,10 @@ func serializeProto(p proto.Marshaler, encodingType commonpb.EncodingType) (*com var err error switch encodingType { - case commonpb.EncodingType_Proto3: + case commonpb.ENCODING_TYPE_PROTO3: data, err = p.Marshal() - case commonpb.EncodingType_JSON: - encodingType = commonpb.EncodingType_JSON + case commonpb.ENCODING_TYPE_JSON: + encodingType = commonpb.ENCODING_TYPE_JSON pb, ok := p.(proto.Message) if !ok { return nil, NewSerializationError("could not cast protomarshal interface to proto.message") @@ -123,9 +123,9 @@ func DeserializeBatchEvents(data *commonpb.DataBlob) ([]*eventpb.HistoryEvent, e events := &eventpb.History{} var err error switch data.EncodingType { - case commonpb.EncodingType_JSON: + case commonpb.ENCODING_TYPE_JSON: err = NewJSONPBEncoder().Decode(data.Data, events) - case commonpb.EncodingType_Proto3: + case commonpb.ENCODING_TYPE_PROTO3: err = proto.Unmarshal(data.Data, events) default: return nil, NewDeserializationError("DeserializeBatchEvents invalid encoding") @@ -149,7 +149,7 @@ func serialize(input interface{}, encodingType commonpb.EncodingType) (*commonpb var err error switch encodingType { - case commonpb.EncodingType_JSON: // For backward-compatibility + case commonpb.ENCODING_TYPE_JSON: // For backward-compatibility data, err = json.Marshal(input) default: return nil, NewUnknownEncodingTypeError(encodingType) @@ -222,7 +222,7 @@ func DeserializeBlobDataToHistoryEvents( historyEvents = append(historyEvents, events...) } - if filterType == filterpb.HistoryEventFilterType_CloseEvent { + if filterType == filterpb.HISTORY_EVENT_FILTER_TYPE_CLOSE_EVENT { historyEvents = []*eventpb.HistoryEvent{historyEvents[len(historyEvents)-1]} } return &eventpb.History{Events: historyEvents}, nil diff --git a/internal/common/util/stringer.go b/internal/common/util/stringer.go index 40c978f1c..1643e825f 100644 --- a/internal/common/util/stringer.go +++ b/internal/common/util/stringer.go @@ -85,67 +85,67 @@ func valueToString(v reflect.Value) string { func HistoryEventToString(e *eventpb.HistoryEvent) string { var data interface{} switch e.GetEventType() { - case eventpb.EventType_WorkflowExecutionStarted: + case eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_STARTED: data = e.GetWorkflowExecutionStartedEventAttributes() - case eventpb.EventType_WorkflowExecutionCompleted: + case eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED: data = e.GetWorkflowExecutionCompletedEventAttributes() - case eventpb.EventType_WorkflowExecutionFailed: + case eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_FAILED: data = e.GetWorkflowExecutionFailedEventAttributes() - case eventpb.EventType_WorkflowExecutionTimedOut: + case eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_TIMED_OUT: data = e.GetWorkflowExecutionTimedOutEventAttributes() - case eventpb.EventType_DecisionTaskScheduled: + case eventpb.EVENT_TYPE_DECISION_TASK_SCHEDULED: data = e.GetDecisionTaskScheduledEventAttributes() - case eventpb.EventType_DecisionTaskStarted: + case eventpb.EVENT_TYPE_DECISION_TASK_STARTED: data = e.GetDecisionTaskStartedEventAttributes() - case eventpb.EventType_DecisionTaskCompleted: + case eventpb.EVENT_TYPE_DECISION_TASK_COMPLETED: data = e.GetDecisionTaskCompletedEventAttributes() - case eventpb.EventType_DecisionTaskTimedOut: + case eventpb.EVENT_TYPE_DECISION_TASK_TIMED_OUT: data = e.GetDecisionTaskTimedOutEventAttributes() - case eventpb.EventType_ActivityTaskScheduled: + case eventpb.EVENT_TYPE_ACTIVITY_TASK_SCHEDULED: data = e.GetActivityTaskScheduledEventAttributes() - case eventpb.EventType_ActivityTaskStarted: + case eventpb.EVENT_TYPE_ACTIVITY_TASK_STARTED: data = e.GetActivityTaskStartedEventAttributes() - case eventpb.EventType_ActivityTaskCompleted: + case eventpb.EVENT_TYPE_ACTIVITY_TASK_COMPLETED: data = e.GetActivityTaskCompletedEventAttributes() - case eventpb.EventType_ActivityTaskFailed: + case eventpb.EVENT_TYPE_ACTIVITY_TASK_FAILED: data = e.GetActivityTaskFailedEventAttributes() - case eventpb.EventType_ActivityTaskTimedOut: + case eventpb.EVENT_TYPE_ACTIVITY_TASK_TIMED_OUT: data = e.GetActivityTaskTimedOutEventAttributes() - case eventpb.EventType_ActivityTaskCancelRequested: + case eventpb.EVENT_TYPE_ACTIVITY_TASK_CANCEL_REQUESTED: data = e.GetActivityTaskCancelRequestedEventAttributes() - case eventpb.EventType_ActivityTaskCanceled: + case eventpb.EVENT_TYPE_ACTIVITY_TASK_CANCELED: data = e.GetActivityTaskCanceledEventAttributes() - case eventpb.EventType_TimerStarted: + case eventpb.EVENT_TYPE_TIMER_STARTED: data = e.GetTimerStartedEventAttributes() - case eventpb.EventType_TimerFired: + case eventpb.EVENT_TYPE_TIMER_FIRED: data = e.GetTimerFiredEventAttributes() - case eventpb.EventType_CancelTimerFailed: + case eventpb.EVENT_TYPE_CANCEL_TIMER_FAILED: data = e.GetCancelTimerFailedEventAttributes() - case eventpb.EventType_TimerCanceled: + case eventpb.EVENT_TYPE_TIMER_CANCELED: data = e.GetTimerCanceledEventAttributes() - case eventpb.EventType_MarkerRecorded: + case eventpb.EVENT_TYPE_MARKER_RECORDED: data = e.GetMarkerRecordedEventAttributes() - case eventpb.EventType_WorkflowExecutionTerminated: + case eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_TERMINATED: data = e.GetWorkflowExecutionTerminatedEventAttributes() default: @@ -159,25 +159,25 @@ func HistoryEventToString(e *eventpb.HistoryEvent) string { func DecisionToString(d *decisionpb.Decision) string { var data interface{} switch d.GetDecisionType() { - case decisionpb.DecisionType_ScheduleActivityTask: + case decisionpb.DECISION_TYPE_SCHEDULE_ACTIVITY_TASK: data = d.GetScheduleActivityTaskDecisionAttributes() - case decisionpb.DecisionType_RequestCancelActivityTask: + case decisionpb.DECISION_TYPE_REQUEST_CANCEL_ACTIVITY_TASK: data = d.GetRequestCancelActivityTaskDecisionAttributes() - case decisionpb.DecisionType_StartTimer: + case decisionpb.DECISION_TYPE_START_TIMER: data = d.GetStartTimerDecisionAttributes() - case decisionpb.DecisionType_CancelTimer: + case decisionpb.DECISION_TYPE_CANCEL_TIMER: data = d.GetCancelTimerDecisionAttributes() - case decisionpb.DecisionType_CompleteWorkflowExecution: + case decisionpb.DECISION_TYPE_COMPLETE_WORKFLOW_EXECUTION: data = d.GetCompleteWorkflowExecutionDecisionAttributes() - case decisionpb.DecisionType_FailWorkflowExecution: + case decisionpb.DECISION_TYPE_FAIL_WORKFLOW_EXECUTION: data = d.GetFailWorkflowExecutionDecisionAttributes() - case decisionpb.DecisionType_RecordMarker: + case decisionpb.DECISION_TYPE_RECORD_MARKER: data = d.GetRecordMarkerDecisionAttributes() default: diff --git a/internal/context.go b/internal/context.go index b56fceecb..ede315aea 100644 --- a/internal/context.go +++ b/internal/context.go @@ -179,7 +179,7 @@ var ErrCanceled = NewCanceledError() // ErrDeadlineExceeded is the error returned by Context.Err when the context's // deadline passes. -var ErrDeadlineExceeded = NewTimeoutError(commonpb.TimeoutType_ScheduleToClose, nil) +var ErrDeadlineExceeded = NewTimeoutError(commonpb.TIMEOUT_TYPE_SCHEDULE_TO_CLOSE, nil) // A CancelFunc tells an operation to abandon its work. // A CancelFunc does not wait for the work to stop. diff --git a/internal/error.go b/internal/error.go index 7d1b227d9..e92894ee7 100644 --- a/internal/error.go +++ b/internal/error.go @@ -276,7 +276,7 @@ func NewTimeoutError(timeoutType commonpb.TimeoutType, cause error, lastHeatbeat // NewHeartbeatTimeoutError creates TimeoutError instance. func NewHeartbeatTimeoutError(details ...interface{}) *TimeoutError { - return NewTimeoutError(commonpb.TimeoutType_Heartbeat, nil, details...) + return NewTimeoutError(commonpb.TIMEOUT_TYPE_HEARTBEAT, nil, details...) } // NewCanceledError creates CanceledError instance. @@ -616,8 +616,8 @@ func IsRetryable(err error, nonRetryableTypes []string) bool { var timeoutErr *TimeoutError if errors.As(err, &timeoutErr) { - if timeoutErr.timeoutType != commonpb.TimeoutType_StartToClose && - timeoutErr.timeoutType != commonpb.TimeoutType_Heartbeat { + if timeoutErr.timeoutType != commonpb.TIMEOUT_TYPE_START_TO_CLOSE && + timeoutErr.timeoutType != commonpb.TIMEOUT_TYPE_HEARTBEAT { return false } } diff --git a/internal/error_test.go b/internal/error_test.go index 04c725716..6dfe478aa 100644 --- a/internal/error_test.go +++ b/internal/error_test.go @@ -101,7 +101,7 @@ func Test_ActivityNotRegistered(t *testing.T) { } func Test_TimeoutError(t *testing.T) { - timeoutErr := NewTimeoutError(commonpb.TimeoutType_ScheduleToStart, nil) + timeoutErr := NewTimeoutError(commonpb.TIMEOUT_TYPE_SCHEDULE_TO_START, nil) require.False(t, timeoutErr.HasLastHeartbeatDetails()) var data string require.Equal(t, ErrNoData, timeoutErr.LastHeartbeatDetails(&data)) @@ -113,9 +113,9 @@ func Test_TimeoutError(t *testing.T) { } func Test_TimeoutError_WithDetails(t *testing.T) { - testTimeoutErrorDetails(t, commonpb.TimeoutType_Heartbeat) - testTimeoutErrorDetails(t, commonpb.TimeoutType_ScheduleToClose) - testTimeoutErrorDetails(t, commonpb.TimeoutType_StartToClose) + testTimeoutErrorDetails(t, commonpb.TIMEOUT_TYPE_HEARTBEAT) + testTimeoutErrorDetails(t, commonpb.TIMEOUT_TYPE_SCHEDULE_TO_CLOSE) + testTimeoutErrorDetails(t, commonpb.TIMEOUT_TYPE_START_TO_CLOSE) } func testTimeoutErrorDetails(t *testing.T, timeoutType commonpb.TimeoutType) { @@ -145,7 +145,7 @@ func testTimeoutErrorDetails(t *testing.T, timeoutType commonpb.TimeoutType) { TimeoutType: timeoutType, }}, }, - RetryStatus: commonpb.RetryStatus_Timeout, + RetryStatus: commonpb.RETRY_STATUS_TIMEOUT, ScheduledEventId: 5, StartedEventId: 6, }) @@ -431,7 +431,7 @@ func Test_SignalExternalWorkflowExecutionFailedError(t *testing.T) { weh := &workflowExecutionEventHandlerImpl{context, nil} event := createTestEventSignalExternalWorkflowExecutionFailed(1, &eventpb.SignalExternalWorkflowExecutionFailedEventAttributes{ InitiatedEventId: initiatedEventID, - Cause: eventpb.SignalExternalWorkflowExecutionFailedCause_ExternalWorkflowExecutionNotFound2, + Cause: eventpb.SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_EXTERNAL_WORKFLOW_EXECUTION_NOT_FOUND, }) require.NoError(t, weh.handleSignalExternalWorkflowExecutionFailed(event)) _, ok := actualErr.(*UnknownExternalWorkflowExecutionError) @@ -517,10 +517,10 @@ func Test_IsRetryable(t *testing.T) { require.False(IsRetryable(NewApplicationError("", true, nil), []string{})) require.True(IsRetryable(NewApplicationError("", false, nil), []string{})) - require.True(IsRetryable(NewTimeoutError(commonpb.TimeoutType_StartToClose, nil), []string{})) - require.False(IsRetryable(NewTimeoutError(commonpb.TimeoutType_ScheduleToStart, nil), []string{})) - require.False(IsRetryable(NewTimeoutError(commonpb.TimeoutType_ScheduleToClose, nil), []string{})) - require.True(IsRetryable(NewTimeoutError(commonpb.TimeoutType_Heartbeat, nil), []string{})) + require.True(IsRetryable(NewTimeoutError(commonpb.TIMEOUT_TYPE_START_TO_CLOSE, nil), []string{})) + require.False(IsRetryable(NewTimeoutError(commonpb.TIMEOUT_TYPE_SCHEDULE_TO_START, nil), []string{})) + require.False(IsRetryable(NewTimeoutError(commonpb.TIMEOUT_TYPE_SCHEDULE_TO_CLOSE, nil), []string{})) + require.True(IsRetryable(NewTimeoutError(commonpb.TIMEOUT_TYPE_HEARTBEAT, nil), []string{})) require.False(IsRetryable(NewServerError("", true, nil), []string{})) require.True(IsRetryable(NewServerError("", false, nil), []string{})) @@ -533,7 +533,7 @@ func Test_IsRetryable(t *testing.T) { require.True(IsRetryable(coolErr, []string{})) require.False(IsRetryable(coolErr, []string{"coolError"})) - workflowExecutionErr := NewWorkflowExecutionError("", "", "", NewActivityError(0, 0, "", nil, "", commonpb.RetryStatus_NonRetryableFailure, coolErr)) + workflowExecutionErr := NewWorkflowExecutionError("", "", "", NewActivityError(0, 0, "", nil, "", commonpb.RETRY_STATUS_NON_RETRYABLE_FAILURE, coolErr)) require.True(IsRetryable(workflowExecutionErr, []string{})) require.False(IsRetryable(workflowExecutionErr, []string{"coolError"})) } @@ -610,10 +610,10 @@ func Test_convertErrorToFailure_PanicError(t *testing.T) { func Test_convertErrorToFailure_TimeoutError(t *testing.T) { require := require.New(t) - err := NewTimeoutError(commonpb.TimeoutType_Heartbeat, &coolError{}) + err := NewTimeoutError(commonpb.TIMEOUT_TYPE_HEARTBEAT, &coolError{}) f := convertErrorToFailure(err, DefaultDataConverter) require.Equal("TimeoutType: Heartbeat, Cause: cool error", f.GetMessage()) - require.Equal(commonpb.TimeoutType_Heartbeat, f.GetTimeoutFailureInfo().GetTimeoutType()) + require.Equal(commonpb.TIMEOUT_TYPE_HEARTBEAT, f.GetTimeoutFailureInfo().GetTimeoutType()) require.Equal(convertErrorToFailure(&coolError{}, DefaultDataConverter), f.GetCause()) require.Equal(f.GetCause(), convertErrorToFailure(&coolError{}, DefaultDataConverter)) @@ -657,7 +657,7 @@ func Test_convertErrorToFailure_ActivityError(t *testing.T) { require := require.New(t) applicationErr := NewApplicationError("app err", true, nil) - err := NewActivityError(8, 22, "alex", &commonpb.ActivityType{Name: "activityType"}, "32283", commonpb.RetryStatus_NonRetryableFailure, applicationErr) + err := NewActivityError(8, 22, "alex", &commonpb.ActivityType{Name: "activityType"}, "32283", commonpb.RETRY_STATUS_NON_RETRYABLE_FAILURE, applicationErr) f := convertErrorToFailure(err, DefaultDataConverter) require.Equal("activity task error (scheduledEventID: 8, startedEventID: 22, identity: alex): app err", f.GetMessage()) require.Equal(int64(8), f.GetActivityFailureInfo().GetScheduledEventId()) @@ -665,7 +665,7 @@ func Test_convertErrorToFailure_ActivityError(t *testing.T) { require.Equal("alex", f.GetActivityFailureInfo().GetIdentity()) require.Equal("activityType", f.GetActivityFailureInfo().GetActivityType().GetName()) require.Equal("32283", f.GetActivityFailureInfo().GetActivityId()) - require.Equal(commonpb.RetryStatus_NonRetryableFailure, f.GetActivityFailureInfo().GetRetryStatus()) + require.Equal(commonpb.RETRY_STATUS_NON_RETRYABLE_FAILURE, f.GetActivityFailureInfo().GetRetryStatus()) require.Equal(convertErrorToFailure(applicationErr, DefaultDataConverter), f.GetCause()) err2 := convertFailureToError(f, DefaultDataConverter) @@ -684,13 +684,13 @@ func Test_convertErrorToFailure_ChildWorkflowExecutionError(t *testing.T) { require := require.New(t) applicationErr := NewApplicationError("app err", true, nil) - err := NewChildWorkflowExecutionError("namespace", "wID", "rID", "wfType", 8, 22, commonpb.RetryStatus_NonRetryableFailure, applicationErr) + err := NewChildWorkflowExecutionError("namespace", "wID", "rID", "wfType", 8, 22, commonpb.RETRY_STATUS_NON_RETRYABLE_FAILURE, applicationErr) f := convertErrorToFailure(err, DefaultDataConverter) require.Equal("child workflow execution error (workflowID: wID, runID: rID, initiatedEventID: 8, startedEventID: 22, workflowType: wfType): app err", f.GetMessage()) require.Equal(int64(8), f.GetChildWorkflowExecutionFailureInfo().GetInitiatedEventId()) require.Equal(int64(22), f.GetChildWorkflowExecutionFailureInfo().GetStartedEventId()) require.Equal("namespace", f.GetChildWorkflowExecutionFailureInfo().GetNamespace()) - require.Equal(commonpb.RetryStatus_NonRetryableFailure, f.GetChildWorkflowExecutionFailureInfo().GetRetryStatus()) + require.Equal(commonpb.RETRY_STATUS_NON_RETRYABLE_FAILURE, f.GetChildWorkflowExecutionFailureInfo().GetRetryStatus()) require.Equal(convertErrorToFailure(applicationErr, DefaultDataConverter), f.GetCause()) err2 := convertFailureToError(f, DefaultDataConverter) @@ -831,7 +831,7 @@ func Test_convertFailureToError_TimeoutFailure(t *testing.T) { require := require.New(t) f := &failurepb.Failure{ FailureInfo: &failurepb.Failure_TimeoutFailureInfo{TimeoutFailureInfo: &failurepb.TimeoutFailureInfo{ - TimeoutType: commonpb.TimeoutType_Heartbeat, + TimeoutType: commonpb.TIMEOUT_TYPE_HEARTBEAT, LastHeartbeatDetails: nil, }}, } @@ -840,7 +840,7 @@ func Test_convertFailureToError_TimeoutFailure(t *testing.T) { var timeoutErr *TimeoutError require.True(errors.As(err, &timeoutErr)) require.Equal("TimeoutType: Heartbeat, Cause: ", timeoutErr.Error()) - require.Equal(commonpb.TimeoutType_Heartbeat, timeoutErr.TimeoutType()) + require.Equal(commonpb.TIMEOUT_TYPE_HEARTBEAT, timeoutErr.TimeoutType()) } func Test_convertFailureToError_ServerFailure(t *testing.T) { diff --git a/internal/internal_decision_state_machine.go b/internal/internal_decision_state_machine.go index 3d8a89aa0..3a5138e83 100644 --- a/internal/internal_decision_state_machine.go +++ b/internal/internal_decision_state_machine.go @@ -280,7 +280,7 @@ func (h *decisionsHelper) newNaiveDecisionStateMachine(decisionType decisionType } func (h *decisionsHelper) newMarkerDecisionStateMachine(id string, attributes *decisionpb.RecordMarkerDecisionAttributes) *markerDecisionStateMachine { - d := createNewDecision(decisionpb.DecisionType_RecordMarker) + d := createNewDecision(decisionpb.DECISION_TYPE_RECORD_MARKER) d.Attributes = &decisionpb.Decision_RecordMarkerDecisionAttributes{RecordMarkerDecisionAttributes: attributes} return &markerDecisionStateMachine{ naiveDecisionStateMachine: h.newNaiveDecisionStateMachine(decisionTypeMarker, id, d), @@ -288,7 +288,7 @@ func (h *decisionsHelper) newMarkerDecisionStateMachine(id string, attributes *d } func (h *decisionsHelper) newCancelExternalWorkflowStateMachine(attributes *decisionpb.RequestCancelExternalWorkflowExecutionDecisionAttributes, cancellationID string) *cancelExternalWorkflowDecisionStateMachine { - d := createNewDecision(decisionpb.DecisionType_RequestCancelExternalWorkflowExecution) + d := createNewDecision(decisionpb.DECISION_TYPE_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION) d.Attributes = &decisionpb.Decision_RequestCancelExternalWorkflowExecutionDecisionAttributes{RequestCancelExternalWorkflowExecutionDecisionAttributes: attributes} return &cancelExternalWorkflowDecisionStateMachine{ naiveDecisionStateMachine: h.newNaiveDecisionStateMachine(decisionTypeCancellation, cancellationID, d), @@ -296,7 +296,7 @@ func (h *decisionsHelper) newCancelExternalWorkflowStateMachine(attributes *deci } func (h *decisionsHelper) newSignalExternalWorkflowStateMachine(attributes *decisionpb.SignalExternalWorkflowExecutionDecisionAttributes, signalID string) *signalExternalWorkflowDecisionStateMachine { - d := createNewDecision(decisionpb.DecisionType_SignalExternalWorkflowExecution) + d := createNewDecision(decisionpb.DECISION_TYPE_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION) d.Attributes = &decisionpb.Decision_SignalExternalWorkflowExecutionDecisionAttributes{SignalExternalWorkflowExecutionDecisionAttributes: attributes} return &signalExternalWorkflowDecisionStateMachine{ naiveDecisionStateMachine: h.newNaiveDecisionStateMachine(decisionTypeSignal, signalID, d), @@ -304,7 +304,7 @@ func (h *decisionsHelper) newSignalExternalWorkflowStateMachine(attributes *deci } func (h *decisionsHelper) newUpsertSearchAttributesStateMachine(attributes *decisionpb.UpsertWorkflowSearchAttributesDecisionAttributes, upsertID string) *upsertSearchAttributesDecisionStateMachine { - d := createNewDecision(decisionpb.DecisionType_UpsertWorkflowSearchAttributes) + d := createNewDecision(decisionpb.DECISION_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES) d.Attributes = &decisionpb.Decision_UpsertWorkflowSearchAttributesDecisionAttributes{UpsertWorkflowSearchAttributesDecisionAttributes: attributes} return &upsertSearchAttributesDecisionStateMachine{ naiveDecisionStateMachine: h.newNaiveDecisionStateMachine(decisionTypeUpsertSearchAttributes, upsertID, d), @@ -450,11 +450,11 @@ func (d *decisionStateMachineBase) String() string { func (d *activityDecisionStateMachine) getDecision() *decisionpb.Decision { switch d.state { case decisionStateCreated: - decision := createNewDecision(decisionpb.DecisionType_ScheduleActivityTask) + decision := createNewDecision(decisionpb.DECISION_TYPE_SCHEDULE_ACTIVITY_TASK) decision.Attributes = &decisionpb.Decision_ScheduleActivityTaskDecisionAttributes{ScheduleActivityTaskDecisionAttributes: d.attributes} return decision case decisionStateCanceledAfterInitiated: - decision := createNewDecision(decisionpb.DecisionType_RequestCancelActivityTask) + decision := createNewDecision(decisionpb.DECISION_TYPE_REQUEST_CANCEL_ACTIVITY_TASK) decision.Attributes = &decisionpb.Decision_RequestCancelActivityTaskDecisionAttributes{RequestCancelActivityTaskDecisionAttributes: &decisionpb.RequestCancelActivityTaskDecisionAttributes{ ScheduledEventId: d.scheduleID, }} @@ -510,11 +510,11 @@ func (d *timerDecisionStateMachine) handleCancelFailedEvent() { func (d *timerDecisionStateMachine) getDecision() *decisionpb.Decision { switch d.state { case decisionStateCreated: - decision := createNewDecision(decisionpb.DecisionType_StartTimer) + decision := createNewDecision(decisionpb.DECISION_TYPE_START_TIMER) decision.Attributes = &decisionpb.Decision_StartTimerDecisionAttributes{StartTimerDecisionAttributes: d.attributes} return decision case decisionStateCanceledAfterInitiated: - decision := createNewDecision(decisionpb.DecisionType_CancelTimer) + decision := createNewDecision(decisionpb.DECISION_TYPE_CANCEL_TIMER) decision.Attributes = &decisionpb.Decision_CancelTimerDecisionAttributes{CancelTimerDecisionAttributes: &decisionpb.CancelTimerDecisionAttributes{ TimerId: d.attributes.TimerId, }} @@ -527,11 +527,11 @@ func (d *timerDecisionStateMachine) getDecision() *decisionpb.Decision { func (d *childWorkflowDecisionStateMachine) getDecision() *decisionpb.Decision { switch d.state { case decisionStateCreated: - decision := createNewDecision(decisionpb.DecisionType_StartChildWorkflowExecution) + decision := createNewDecision(decisionpb.DECISION_TYPE_START_CHILD_WORKFLOW_EXECUTION) decision.Attributes = &decisionpb.Decision_StartChildWorkflowExecutionDecisionAttributes{StartChildWorkflowExecutionDecisionAttributes: d.attributes} return decision case decisionStateCanceledAfterStarted: - decision := createNewDecision(decisionpb.DecisionType_RequestCancelExternalWorkflowExecution) + decision := createNewDecision(decisionpb.DECISION_TYPE_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION) decision.Attributes = &decisionpb.Decision_RequestCancelExternalWorkflowExecutionDecisionAttributes{RequestCancelExternalWorkflowExecutionDecisionAttributes: &decisionpb.RequestCancelExternalWorkflowExecutionDecisionAttributes{ Namespace: d.attributes.Namespace, WorkflowId: d.attributes.WorkflowId, @@ -808,13 +808,13 @@ func (h *decisionsHelper) handleActivityTaskCanceled(activityID string) decision func (h *decisionsHelper) getActivityID(event *eventpb.HistoryEvent) string { var scheduledEventID int64 = -1 switch event.GetEventType() { - case eventpb.EventType_ActivityTaskCanceled: + case eventpb.EVENT_TYPE_ACTIVITY_TASK_CANCELED: scheduledEventID = event.GetActivityTaskCanceledEventAttributes().GetScheduledEventId() - case eventpb.EventType_ActivityTaskCompleted: + case eventpb.EVENT_TYPE_ACTIVITY_TASK_COMPLETED: scheduledEventID = event.GetActivityTaskCompletedEventAttributes().GetScheduledEventId() - case eventpb.EventType_ActivityTaskFailed: + case eventpb.EVENT_TYPE_ACTIVITY_TASK_FAILED: scheduledEventID = event.GetActivityTaskFailedEventAttributes().GetScheduledEventId() - case eventpb.EventType_ActivityTaskTimedOut: + case eventpb.EVENT_TYPE_ACTIVITY_TASK_TIMED_OUT: scheduledEventID = event.GetActivityTaskTimedOutEventAttributes().GetScheduledEventId() default: panicIllegalState(fmt.Sprintf("unexpected event type %v", event.GetEventType())) diff --git a/internal/internal_decision_state_machine_test.go b/internal/internal_decision_state_machine_test.go index 3095b4a44..9bbd5fbd6 100644 --- a/internal/internal_decision_state_machine_test.go +++ b/internal/internal_decision_state_machine_test.go @@ -60,7 +60,7 @@ func Test_TimerStateMachine_CancelAfterInitiated(t *testing.T) { decisions := h.getDecisions(true) require.Equal(t, decisionStateDecisionSent, d.getState()) require.Equal(t, 1, len(decisions)) - require.Equal(t, decisionpb.DecisionType_StartTimer, decisions[0].GetDecisionType()) + require.Equal(t, decisionpb.DECISION_TYPE_START_TIMER, decisions[0].GetDecisionType()) require.Equal(t, attributes, decisions[0].GetStartTimerDecisionAttributes()) h.handleTimerStarted(timerID) require.Equal(t, decisionStateInitiated, d.getState()) @@ -68,7 +68,7 @@ func Test_TimerStateMachine_CancelAfterInitiated(t *testing.T) { require.Equal(t, decisionStateCanceledAfterInitiated, d.getState()) decisions = h.getDecisions(true) require.Equal(t, 1, len(decisions)) - require.Equal(t, decisionpb.DecisionType_CancelTimer, decisions[0].GetDecisionType()) + require.Equal(t, decisionpb.DECISION_TYPE_CANCEL_TIMER, decisions[0].GetDecisionType()) require.Equal(t, decisionStateCancellationDecisionSent, d.getState()) h.handleTimerCanceled(timerID) require.Equal(t, decisionStateCompleted, d.getState()) @@ -86,7 +86,7 @@ func Test_TimerStateMachine_CompletedAfterCancel(t *testing.T) { decisions := h.getDecisions(true) require.Equal(t, decisionStateDecisionSent, d.getState()) require.Equal(t, 1, len(decisions)) - require.Equal(t, decisionpb.DecisionType_StartTimer, decisions[0].GetDecisionType()) + require.Equal(t, decisionpb.DECISION_TYPE_START_TIMER, decisions[0].GetDecisionType()) h.cancelTimer(timerID) require.Equal(t, decisionStateCanceledBeforeInitiated, d.getState()) require.Equal(t, 0, len(h.getDecisions(true))) @@ -94,7 +94,7 @@ func Test_TimerStateMachine_CompletedAfterCancel(t *testing.T) { require.Equal(t, decisionStateCanceledAfterInitiated, d.getState()) decisions = h.getDecisions(true) require.Equal(t, 1, len(decisions)) - require.Equal(t, decisionpb.DecisionType_CancelTimer, decisions[0].GetDecisionType()) + require.Equal(t, decisionpb.DECISION_TYPE_CANCEL_TIMER, decisions[0].GetDecisionType()) require.Equal(t, decisionStateCancellationDecisionSent, d.getState()) h.handleTimerClosed(timerID) require.Equal(t, decisionStateCompletedAfterCancellationDecisionSent, d.getState()) @@ -112,7 +112,7 @@ func Test_TimerStateMachine_CompleteWithoutCancel(t *testing.T) { decisions := h.getDecisions(true) require.Equal(t, decisionStateDecisionSent, d.getState()) require.Equal(t, 1, len(decisions)) - require.Equal(t, decisionpb.DecisionType_StartTimer, decisions[0].GetDecisionType()) + require.Equal(t, decisionpb.DECISION_TYPE_START_TIMER, decisions[0].GetDecisionType()) h.handleTimerStarted(timerID) require.Equal(t, decisionStateInitiated, d.getState()) require.Equal(t, 0, len(h.getDecisions(false))) @@ -152,7 +152,7 @@ func Test_TimerCancelEventOrdering(t *testing.T) { decisions := h.getDecisions(true) require.Equal(t, decisionStateDecisionSent, d.getState()) require.Equal(t, 1, len(decisions)) - require.Equal(t, decisionpb.DecisionType_StartTimer, decisions[0].GetDecisionType()) + require.Equal(t, decisionpb.DECISION_TYPE_START_TIMER, decisions[0].GetDecisionType()) require.Equal(t, attributes, decisions[0].GetStartTimerDecisionAttributes()) h.handleTimerStarted(timerID) require.Equal(t, decisionStateInitiated, d.getState()) @@ -162,8 +162,8 @@ func Test_TimerCancelEventOrdering(t *testing.T) { require.Equal(t, decisionStateCanceledAfterInitiated, d.getState()) decisions = h.getDecisions(true) require.Equal(t, 2, len(decisions)) - require.Equal(t, decisionpb.DecisionType_RecordMarker, decisions[0].GetDecisionType()) - require.Equal(t, decisionpb.DecisionType_CancelTimer, decisions[1].GetDecisionType()) + require.Equal(t, decisionpb.DECISION_TYPE_RECORD_MARKER, decisions[0].GetDecisionType()) + require.Equal(t, decisionpb.DECISION_TYPE_CANCEL_TIMER, decisions[1].GetDecisionType()) } func Test_ActivityStateMachine_CompleteWithoutCancel(t *testing.T) { @@ -182,7 +182,7 @@ func Test_ActivityStateMachine_CompleteWithoutCancel(t *testing.T) { decisions := h.getDecisions(true) require.Equal(t, decisionStateDecisionSent, d.getState()) require.Equal(t, 1, len(decisions)) - require.Equal(t, decisionpb.DecisionType_ScheduleActivityTask, decisions[0].GetDecisionType()) + require.Equal(t, decisionpb.DECISION_TYPE_SCHEDULE_ACTIVITY_TASK, decisions[0].GetDecisionType()) // activity scheduled h.handleActivityTaskScheduled(scheduleID, activityID) @@ -231,7 +231,7 @@ func Test_ActivityStateMachine_CancelAfterSent(t *testing.T) { require.Equal(t, decisionStateCreated, d.getState()) decisions := h.getDecisions(true) require.Equal(t, 1, len(decisions)) - require.Equal(t, decisionpb.DecisionType_ScheduleActivityTask, decisions[0].GetDecisionType()) + require.Equal(t, decisionpb.DECISION_TYPE_SCHEDULE_ACTIVITY_TASK, decisions[0].GetDecisionType()) // cancel activity h.requestCancelActivityTask(activityID) @@ -243,7 +243,7 @@ func Test_ActivityStateMachine_CancelAfterSent(t *testing.T) { require.Equal(t, decisionStateCanceledAfterInitiated, d.getState()) decisions = h.getDecisions(true) require.Equal(t, 1, len(decisions)) - require.Equal(t, decisionpb.DecisionType_RequestCancelActivityTask, decisions[0].GetDecisionType()) + require.Equal(t, decisionpb.DECISION_TYPE_REQUEST_CANCEL_ACTIVITY_TASK, decisions[0].GetDecisionType()) // activity canceled h.handleActivityTaskCanceled(activityID) @@ -266,7 +266,7 @@ func Test_ActivityStateMachine_CompletedAfterCancel(t *testing.T) { require.Equal(t, decisionStateCreated, d.getState()) decisions := h.getDecisions(true) require.Equal(t, 1, len(decisions)) - require.Equal(t, decisionpb.DecisionType_ScheduleActivityTask, decisions[0].GetDecisionType()) + require.Equal(t, decisionpb.DECISION_TYPE_SCHEDULE_ACTIVITY_TASK, decisions[0].GetDecisionType()) // cancel activity h.requestCancelActivityTask(activityID) @@ -278,7 +278,7 @@ func Test_ActivityStateMachine_CompletedAfterCancel(t *testing.T) { require.Equal(t, decisionStateCanceledAfterInitiated, d.getState()) decisions = h.getDecisions(true) require.Equal(t, 1, len(decisions)) - require.Equal(t, decisionpb.DecisionType_RequestCancelActivityTask, decisions[0].GetDecisionType()) + require.Equal(t, decisionpb.DECISION_TYPE_REQUEST_CANCEL_ACTIVITY_TASK, decisions[0].GetDecisionType()) // activity completed after cancel h.handleActivityTaskClosed(activityID) @@ -333,7 +333,7 @@ func Test_ChildWorkflowStateMachine_Basic(t *testing.T) { decisions := h.getDecisions(true) require.Equal(t, decisionStateDecisionSent, d.getState()) require.Equal(t, 1, len(decisions)) - require.Equal(t, decisionpb.DecisionType_StartChildWorkflowExecution, decisions[0].GetDecisionType()) + require.Equal(t, decisionpb.DECISION_TYPE_START_CHILD_WORKFLOW_EXECUTION, decisions[0].GetDecisionType()) // child workflow initiated h.handleStartChildWorkflowExecutionInitiated(workflowID) @@ -380,7 +380,7 @@ func Test_ChildWorkflowStateMachine_CancelSucceed(t *testing.T) { decisions := h.getDecisions(true) require.Equal(t, decisionStateCancellationDecisionSent, d.getState()) require.Equal(t, 1, len(decisions)) - require.Equal(t, decisionpb.DecisionType_RequestCancelExternalWorkflowExecution, decisions[0].GetDecisionType()) + require.Equal(t, decisionpb.DECISION_TYPE_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION, decisions[0].GetDecisionType()) // cancel request initiated h.handleRequestCancelExternalWorkflowExecutionInitiated(initiatedEventID, workflowID, cancellationID) @@ -448,7 +448,7 @@ func Test_ChildWorkflowStateMachine_InvalidStates(t *testing.T) { decisions = h.getDecisions(true) require.Equal(t, decisionStateCancellationDecisionSent, d.getState()) require.Equal(t, 1, len(decisions)) - require.Equal(t, decisionpb.DecisionType_RequestCancelExternalWorkflowExecution, decisions[0].GetDecisionType()) + require.Equal(t, decisionpb.DECISION_TYPE_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION, decisions[0].GetDecisionType()) // invalid: start child workflow failed after it was already started err = runAndCatchPanic(func() { @@ -525,7 +525,7 @@ func Test_MarkerStateMachine(t *testing.T) { decisions := h.getDecisions(true) require.Equal(t, decisionStateCompleted, d.getState()) require.Equal(t, 1, len(decisions)) - require.Equal(t, decisionpb.DecisionType_RecordMarker, decisions[0].GetDecisionType()) + require.Equal(t, decisionpb.DECISION_TYPE_RECORD_MARKER, decisions[0].GetDecisionType()) } func Test_UpsertSearchAttributesDecisionStateMachine(t *testing.T) { @@ -539,7 +539,7 @@ func Test_UpsertSearchAttributesDecisionStateMachine(t *testing.T) { decisions := h.getDecisions(true) require.Equal(t, decisionStateCompleted, d.getState()) require.Equal(t, 1, len(decisions)) - require.Equal(t, decisionpb.DecisionType_UpsertWorkflowSearchAttributes, decisions[0].GetDecisionType()) + require.Equal(t, decisionpb.DECISION_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES, decisions[0].GetDecisionType()) } func Test_CancelExternalWorkflowStateMachine_Succeed(t *testing.T) { @@ -560,7 +560,7 @@ func Test_CancelExternalWorkflowStateMachine_Succeed(t *testing.T) { // send decisions decisions := h.getDecisions(true) require.Equal(t, 1, len(decisions)) - require.Equal(t, decisionpb.DecisionType_RequestCancelExternalWorkflowExecution, decisions[0].GetDecisionType()) + require.Equal(t, decisionpb.DECISION_TYPE_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION, decisions[0].GetDecisionType()) require.Equal( t, &decisionpb.RequestCancelExternalWorkflowExecutionDecisionAttributes{ @@ -606,7 +606,7 @@ func Test_CancelExternalWorkflowStateMachine_Failed(t *testing.T) { // send decisions decisions := h.getDecisions(true) require.Equal(t, 1, len(decisions)) - require.Equal(t, decisionpb.DecisionType_RequestCancelExternalWorkflowExecution, decisions[0].GetDecisionType()) + require.Equal(t, decisionpb.DECISION_TYPE_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION, decisions[0].GetDecisionType()) require.Equal( t, &decisionpb.RequestCancelExternalWorkflowExecutionDecisionAttributes{ diff --git a/internal/internal_event_handlers.go b/internal/internal_event_handlers.go index 33d0c54d5..8ed7a078c 100644 --- a/internal/internal_event_handlers.go +++ b/internal/internal_event_handlers.go @@ -775,125 +775,125 @@ func (weh *workflowExecutionEventHandlerImpl) ProcessEvent( }) switch event.GetEventType() { - case eventpb.EventType_WorkflowExecutionStarted: + case eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_STARTED: err = weh.handleWorkflowExecutionStarted(event.GetWorkflowExecutionStartedEventAttributes()) - case eventpb.EventType_WorkflowExecutionCompleted: + case eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED: // No Operation - case eventpb.EventType_WorkflowExecutionFailed: + case eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_FAILED: // No Operation - case eventpb.EventType_WorkflowExecutionTimedOut: + case eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_TIMED_OUT: // No Operation - case eventpb.EventType_DecisionTaskScheduled: + case eventpb.EVENT_TYPE_DECISION_TASK_SCHEDULED: // No Operation - case eventpb.EventType_DecisionTaskStarted: + case eventpb.EVENT_TYPE_DECISION_TASK_STARTED: // Set replay clock. weh.SetCurrentReplayTime(time.Unix(0, event.GetTimestamp())) // Reset the counter on decision helper used for generating ID for decisions weh.decisionsHelper.setCurrentDecisionStartedEventID(event.GetEventId()) weh.workflowDefinition.OnDecisionTaskStarted() - case eventpb.EventType_DecisionTaskTimedOut: + case eventpb.EVENT_TYPE_DECISION_TASK_TIMED_OUT: // No Operation - case eventpb.EventType_DecisionTaskFailed: + case eventpb.EVENT_TYPE_DECISION_TASK_FAILED: // No Operation - case eventpb.EventType_DecisionTaskCompleted: + case eventpb.EVENT_TYPE_DECISION_TASK_COMPLETED: // No Operation - case eventpb.EventType_ActivityTaskScheduled: + case eventpb.EVENT_TYPE_ACTIVITY_TASK_SCHEDULED: weh.decisionsHelper.handleActivityTaskScheduled( event.GetEventId(), event.GetActivityTaskScheduledEventAttributes().GetActivityId()) - case eventpb.EventType_ActivityTaskStarted: + case eventpb.EVENT_TYPE_ACTIVITY_TASK_STARTED: // No Operation - case eventpb.EventType_ActivityTaskCompleted: + case eventpb.EVENT_TYPE_ACTIVITY_TASK_COMPLETED: err = weh.handleActivityTaskCompleted(event) - case eventpb.EventType_ActivityTaskFailed: + case eventpb.EVENT_TYPE_ACTIVITY_TASK_FAILED: err = weh.handleActivityTaskFailed(event) - case eventpb.EventType_ActivityTaskTimedOut: + case eventpb.EVENT_TYPE_ACTIVITY_TASK_TIMED_OUT: err = weh.handleActivityTaskTimedOut(event) - case eventpb.EventType_ActivityTaskCancelRequested: + case eventpb.EVENT_TYPE_ACTIVITY_TASK_CANCEL_REQUESTED: weh.decisionsHelper.handleActivityTaskCancelRequested( event.GetActivityTaskCancelRequestedEventAttributes().GetScheduledEventId()) - case eventpb.EventType_ActivityTaskCanceled: + case eventpb.EVENT_TYPE_ACTIVITY_TASK_CANCELED: err = weh.handleActivityTaskCanceled(event) - case eventpb.EventType_TimerStarted: + case eventpb.EVENT_TYPE_TIMER_STARTED: weh.decisionsHelper.handleTimerStarted(event.GetTimerStartedEventAttributes().GetTimerId()) - case eventpb.EventType_TimerFired: + case eventpb.EVENT_TYPE_TIMER_FIRED: weh.handleTimerFired(event) - case eventpb.EventType_TimerCanceled: + case eventpb.EVENT_TYPE_TIMER_CANCELED: weh.decisionsHelper.handleTimerCanceled(event.GetTimerCanceledEventAttributes().GetTimerId()) - case eventpb.EventType_CancelTimerFailed: + case eventpb.EVENT_TYPE_CANCEL_TIMER_FAILED: weh.decisionsHelper.handleCancelTimerFailed(event.GetCancelTimerFailedEventAttributes().GetTimerId()) - case eventpb.EventType_WorkflowExecutionCancelRequested: + case eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_CANCEL_REQUESTED: weh.handleWorkflowExecutionCancelRequested() - case eventpb.EventType_WorkflowExecutionCanceled: + case eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_CANCELED: // No Operation. - case eventpb.EventType_RequestCancelExternalWorkflowExecutionInitiated: + case eventpb.EVENT_TYPE_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_INITIATED: _ = weh.handleRequestCancelExternalWorkflowExecutionInitiated(event) - case eventpb.EventType_RequestCancelExternalWorkflowExecutionFailed: + case eventpb.EVENT_TYPE_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_FAILED: _ = weh.handleRequestCancelExternalWorkflowExecutionFailed(event) - case eventpb.EventType_ExternalWorkflowExecutionCancelRequested: + case eventpb.EVENT_TYPE_EXTERNAL_WORKFLOW_EXECUTION_CANCEL_REQUESTED: _ = weh.handleExternalWorkflowExecutionCancelRequested(event) - case eventpb.EventType_WorkflowExecutionContinuedAsNew: + case eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_CONTINUED_AS_NEW: // No Operation. - case eventpb.EventType_WorkflowExecutionSignaled: + case eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_SIGNALED: weh.handleWorkflowExecutionSignaled(event.GetWorkflowExecutionSignaledEventAttributes()) - case eventpb.EventType_SignalExternalWorkflowExecutionInitiated: + case eventpb.EVENT_TYPE_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_INITIATED: signalID := string(event.GetSignalExternalWorkflowExecutionInitiatedEventAttributes().Control) weh.decisionsHelper.handleSignalExternalWorkflowExecutionInitiated(event.GetEventId(), signalID) - case eventpb.EventType_SignalExternalWorkflowExecutionFailed: + case eventpb.EVENT_TYPE_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED: _ = weh.handleSignalExternalWorkflowExecutionFailed(event) - case eventpb.EventType_ExternalWorkflowExecutionSignaled: + case eventpb.EVENT_TYPE_EXTERNAL_WORKFLOW_EXECUTION_SIGNALED: _ = weh.handleSignalExternalWorkflowExecutionCompleted(event) - case eventpb.EventType_MarkerRecorded: + case eventpb.EVENT_TYPE_MARKER_RECORDED: err = weh.handleMarkerRecorded(event.GetEventId(), event.GetMarkerRecordedEventAttributes()) - case eventpb.EventType_StartChildWorkflowExecutionInitiated: + case eventpb.EVENT_TYPE_START_CHILD_WORKFLOW_EXECUTION_INITIATED: weh.decisionsHelper.handleStartChildWorkflowExecutionInitiated( event.GetStartChildWorkflowExecutionInitiatedEventAttributes().GetWorkflowId()) - case eventpb.EventType_StartChildWorkflowExecutionFailed: + case eventpb.EVENT_TYPE_START_CHILD_WORKFLOW_EXECUTION_FAILED: err = weh.handleStartChildWorkflowExecutionFailed(event) - case eventpb.EventType_ChildWorkflowExecutionStarted: + case eventpb.EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_STARTED: err = weh.handleChildWorkflowExecutionStarted(event) - case eventpb.EventType_ChildWorkflowExecutionCompleted: + case eventpb.EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_COMPLETED: err = weh.handleChildWorkflowExecutionCompleted(event) - case eventpb.EventType_ChildWorkflowExecutionFailed: + case eventpb.EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_FAILED: err = weh.handleChildWorkflowExecutionFailed(event) - case eventpb.EventType_ChildWorkflowExecutionCanceled: + case eventpb.EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_CANCELED: err = weh.handleChildWorkflowExecutionCanceled(event) - case eventpb.EventType_ChildWorkflowExecutionTimedOut: + case eventpb.EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_TIMED_OUT: err = weh.handleChildWorkflowExecutionTimedOut(event) - case eventpb.EventType_ChildWorkflowExecutionTerminated: + case eventpb.EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_TERMINATED: err = weh.handleChildWorkflowExecutionTerminated(event) - case eventpb.EventType_UpsertWorkflowSearchAttributes: + case eventpb.EVENT_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES: weh.handleUpsertWorkflowSearchAttributes(event) default: @@ -910,7 +910,7 @@ func (weh *workflowExecutionEventHandlerImpl) ProcessEvent( // When replaying histories to get stack trace or current state the last event might be not // decision started. So always call OnDecisionTaskStarted on the last event. // Don't call for EventType_DecisionTaskStarted as it was already called when handling it. - if isLast && event.GetEventType() != eventpb.EventType_DecisionTaskStarted { + if isLast && event.GetEventType() != eventpb.EVENT_TYPE_DECISION_TASK_STARTED { weh.workflowDefinition.OnDecisionTaskStarted() } @@ -1045,7 +1045,7 @@ func (weh *workflowExecutionEventHandlerImpl) handleActivityTaskCanceled(event * attributes.GetIdentity(), &commonpb.ActivityType{Name: activity.activityType.Name}, activityID, - commonpb.RetryStatus_NonRetryableFailure, + commonpb.RETRY_STATUS_NON_RETRYABLE_FAILURE, NewCanceledError(details), ) @@ -1203,7 +1203,7 @@ func (weh *workflowExecutionEventHandlerImpl) ProcessLocalActivityResult(lar *lo // create marker event for local activity result markerEvent := &eventpb.HistoryEvent{ - EventType: eventpb.EventType_MarkerRecorded, + EventType: eventpb.EVENT_TYPE_MARKER_RECORDED, Attributes: &eventpb.HistoryEvent_MarkerRecordedEventAttributes{MarkerRecordedEventAttributes: &eventpb.MarkerRecordedEventAttributes{ MarkerName: localActivityMarkerName, Failure: convertErrorToFailure(lar.err, weh.GetDataConverter()), @@ -1307,7 +1307,7 @@ func (weh *workflowExecutionEventHandlerImpl) handleChildWorkflowExecutionCancel attributes.GetWorkflowType().GetName(), attributes.GetInitiatedEventId(), attributes.GetStartedEventId(), - commonpb.RetryStatus_NonRetryableFailure, + commonpb.RETRY_STATUS_NON_RETRYABLE_FAILURE, NewCanceledError(details), ) childWorkflow.handle(nil, childWorkflowExecutionError) @@ -1331,7 +1331,7 @@ func (weh *workflowExecutionEventHandlerImpl) handleChildWorkflowExecutionTimedO attributes.GetInitiatedEventId(), attributes.GetStartedEventId(), attributes.GetRetryStatus(), - NewTimeoutError(commonpb.TimeoutType_StartToClose, nil), + NewTimeoutError(commonpb.TIMEOUT_TYPE_START_TO_CLOSE, nil), ) childWorkflow.handle(nil, childWorkflowExecutionError) return nil @@ -1353,7 +1353,7 @@ func (weh *workflowExecutionEventHandlerImpl) handleChildWorkflowExecutionTermin attributes.GetWorkflowType().GetName(), attributes.GetInitiatedEventId(), attributes.GetStartedEventId(), - commonpb.RetryStatus_NonRetryableFailure, + commonpb.RETRY_STATUS_NON_RETRYABLE_FAILURE, newTerminatedError(), ) childWorkflow.handle(nil, childWorkflowExecutionError) @@ -1433,7 +1433,7 @@ func (weh *workflowExecutionEventHandlerImpl) handleSignalExternalWorkflowExecut var err error switch attributes.GetCause() { - case eventpb.SignalExternalWorkflowExecutionFailedCause_ExternalWorkflowExecutionNotFound2: + case eventpb.SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_EXTERNAL_WORKFLOW_EXECUTION_NOT_FOUND: err = newUnknownExternalWorkflowExecutionError() default: err = fmt.Errorf("signal external workflow failed, %v", attributes.GetCause()) diff --git a/internal/internal_task_handlers.go b/internal/internal_task_handlers.go index 3a8299e9a..03a8fbff7 100644 --- a/internal/internal_task_handlers.go +++ b/internal/internal_task_handlers.go @@ -191,7 +191,7 @@ func (e decisionHeartbeatError) Error() string { // Get workflow start event. func (eh *history) GetWorkflowStartedEvent() (*eventpb.HistoryEvent, error) { events := eh.workflowTask.task.History.Events - if len(events) == 0 || events[0].GetEventType() != eventpb.EventType_WorkflowExecutionStarted { + if len(events) == 0 || events[0].GetEventType() != eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_STARTED { return nil, errors.New("unable to find WorkflowExecutionStartedEventAttributes in the history") } return events[0], nil @@ -213,9 +213,9 @@ func (eh *history) IsNextDecisionFailed() (isFailed bool, binaryChecksum string, if nextIndex < len(eh.loadedEvents) { nextEvent := eh.loadedEvents[nextIndex] nextEventType := nextEvent.GetEventType() - isFailed := nextEventType == eventpb.EventType_DecisionTaskTimedOut || nextEventType == eventpb.EventType_DecisionTaskFailed + isFailed := nextEventType == eventpb.EVENT_TYPE_DECISION_TASK_TIMED_OUT || nextEventType == eventpb.EVENT_TYPE_DECISION_TASK_FAILED var binaryChecksum string - if nextEventType == eventpb.EventType_DecisionTaskCompleted { + if nextEventType == eventpb.EVENT_TYPE_DECISION_TASK_COMPLETED { binaryChecksum = nextEvent.GetDecisionTaskCompletedEventAttributes().BinaryChecksum } return isFailed, binaryChecksum, nil @@ -237,20 +237,20 @@ func (eh *history) loadMoreEvents() error { func isDecisionEvent(eventType eventpb.EventType) bool { switch eventType { - case eventpb.EventType_WorkflowExecutionCompleted, - eventpb.EventType_WorkflowExecutionFailed, - eventpb.EventType_WorkflowExecutionCanceled, - eventpb.EventType_WorkflowExecutionContinuedAsNew, - eventpb.EventType_ActivityTaskScheduled, - eventpb.EventType_ActivityTaskCancelRequested, - eventpb.EventType_TimerStarted, - eventpb.EventType_TimerCanceled, - eventpb.EventType_CancelTimerFailed, - eventpb.EventType_MarkerRecorded, - eventpb.EventType_StartChildWorkflowExecutionInitiated, - eventpb.EventType_RequestCancelExternalWorkflowExecutionInitiated, - eventpb.EventType_SignalExternalWorkflowExecutionInitiated, - eventpb.EventType_UpsertWorkflowSearchAttributes: + case eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED, + eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_FAILED, + eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_CANCELED, + eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_CONTINUED_AS_NEW, + eventpb.EVENT_TYPE_ACTIVITY_TASK_SCHEDULED, + eventpb.EVENT_TYPE_ACTIVITY_TASK_CANCEL_REQUESTED, + eventpb.EVENT_TYPE_TIMER_STARTED, + eventpb.EVENT_TYPE_TIMER_CANCELED, + eventpb.EVENT_TYPE_CANCEL_TIMER_FAILED, + eventpb.EVENT_TYPE_MARKER_RECORDED, + eventpb.EVENT_TYPE_START_CHILD_WORKFLOW_EXECUTION_INITIATED, + eventpb.EVENT_TYPE_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_INITIATED, + eventpb.EVENT_TYPE_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_INITIATED, + eventpb.EVENT_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES: return true default: return false @@ -337,7 +337,7 @@ OrderEvents: eh.nextEventID++ switch event.GetEventType() { - case eventpb.EventType_DecisionTaskStarted: + case eventpb.EVENT_TYPE_DECISION_TASK_STARTED: isFailed, binaryChecksum, err1 := eh.IsNextDecisionFailed() if err1 != nil { err = err1 @@ -349,9 +349,9 @@ OrderEvents: nextEvents = append(nextEvents, event) break OrderEvents } - case eventpb.EventType_DecisionTaskScheduled, - eventpb.EventType_DecisionTaskTimedOut, - eventpb.EventType_DecisionTaskFailed: + case eventpb.EVENT_TYPE_DECISION_TASK_SCHEDULED, + eventpb.EVENT_TYPE_DECISION_TASK_TIMED_OUT, + eventpb.EVENT_TYPE_DECISION_TASK_FAILED: // Skip default: if isPreloadMarkerEvent(event) { @@ -370,7 +370,7 @@ OrderEvents: } func isPreloadMarkerEvent(event *eventpb.HistoryEvent) bool { - return event.GetEventType() == eventpb.EventType_MarkerRecorded + return event.GetEventType() == eventpb.EVENT_TYPE_MARKER_RECORDED } // newWorkflowTaskHandler returns an implementation of workflow task handler. @@ -699,7 +699,7 @@ func (wth *workflowTaskHandlerImpl) getOrCreateWorkflowContext( } func isFullHistory(history *eventpb.History) bool { - if len(history.Events) == 0 || history.Events[0].GetEventType() != eventpb.EventType_WorkflowExecutionStarted { + if len(history.Events) == 0 || history.Events[0].GetEventType() != eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_STARTED { return false } return true @@ -1129,7 +1129,7 @@ func (w *workflowExecutionContextImpl) GetWorkflowTaskTimeout() time.Duration { } func skipDeterministicCheckForDecision(d *decisionpb.Decision) bool { - if d.GetDecisionType() == decisionpb.DecisionType_RecordMarker { + if d.GetDecisionType() == decisionpb.DECISION_TYPE_RECORD_MARKER { markerName := d.GetRecordMarkerDecisionAttributes().GetMarkerName() if markerName == versionMarkerName || markerName == mutableSideEffectMarkerName { return true @@ -1139,7 +1139,7 @@ func skipDeterministicCheckForDecision(d *decisionpb.Decision) bool { } func skipDeterministicCheckForEvent(e *eventpb.HistoryEvent) bool { - if e.GetEventType() == eventpb.EventType_MarkerRecorded { + if e.GetEventType() == eventpb.EVENT_TYPE_MARKER_RECORDED { markerName := e.GetMarkerRecordedEventAttributes().GetMarkerName() if markerName == versionMarkerName || markerName == mutableSideEffectMarkerName { return true @@ -1151,10 +1151,10 @@ func skipDeterministicCheckForEvent(e *eventpb.HistoryEvent) bool { // special check for upsert change version event func skipDeterministicCheckForUpsertChangeVersion(events []*eventpb.HistoryEvent, idx int) bool { e := events[idx] - if e.GetEventType() == eventpb.EventType_MarkerRecorded && + if e.GetEventType() == eventpb.EVENT_TYPE_MARKER_RECORDED && e.GetMarkerRecordedEventAttributes().GetMarkerName() == versionMarkerName && idx < len(events)-1 && - events[idx+1].GetEventType() == eventpb.EventType_UpsertWorkflowSearchAttributes { + events[idx+1].GetEventType() == eventpb.EVENT_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES { if _, ok := events[idx+1].GetUpsertWorkflowSearchAttributesEventAttributes().SearchAttributes.IndexedFields[TemporalChangeVersion]; ok { return true } @@ -1220,8 +1220,8 @@ func lastPartOfName(name string) string { func isDecisionMatchEvent(d *decisionpb.Decision, e *eventpb.HistoryEvent, strictMode bool) bool { switch d.GetDecisionType() { - case decisionpb.DecisionType_ScheduleActivityTask: - if e.GetEventType() != eventpb.EventType_ActivityTaskScheduled { + case decisionpb.DECISION_TYPE_SCHEDULE_ACTIVITY_TASK: + if e.GetEventType() != eventpb.EVENT_TYPE_ACTIVITY_TASK_SCHEDULED { return false } eventAttributes := e.GetActivityTaskScheduledEventAttributes() @@ -1236,8 +1236,8 @@ func isDecisionMatchEvent(d *decisionpb.Decision, e *eventpb.HistoryEvent, stric return true - case decisionpb.DecisionType_RequestCancelActivityTask: - if e.GetEventType() != eventpb.EventType_ActivityTaskCancelRequested { + case decisionpb.DECISION_TYPE_REQUEST_CANCEL_ACTIVITY_TASK: + if e.GetEventType() != eventpb.EVENT_TYPE_ACTIVITY_TASK_CANCEL_REQUESTED { return false } decisionAttributes := d.GetRequestCancelActivityTaskDecisionAttributes() @@ -1248,8 +1248,8 @@ func isDecisionMatchEvent(d *decisionpb.Decision, e *eventpb.HistoryEvent, stric return true - case decisionpb.DecisionType_StartTimer: - if e.GetEventType() != eventpb.EventType_TimerStarted { + case decisionpb.DECISION_TYPE_START_TIMER: + if e.GetEventType() != eventpb.EVENT_TYPE_TIMER_STARTED { return false } eventAttributes := e.GetTimerStartedEventAttributes() @@ -1262,17 +1262,17 @@ func isDecisionMatchEvent(d *decisionpb.Decision, e *eventpb.HistoryEvent, stric return true - case decisionpb.DecisionType_CancelTimer: - if e.GetEventType() != eventpb.EventType_TimerCanceled && e.GetEventType() != eventpb.EventType_CancelTimerFailed { + case decisionpb.DECISION_TYPE_CANCEL_TIMER: + if e.GetEventType() != eventpb.EVENT_TYPE_TIMER_CANCELED && e.GetEventType() != eventpb.EVENT_TYPE_CANCEL_TIMER_FAILED { return false } decisionAttributes := d.GetCancelTimerDecisionAttributes() - if e.GetEventType() == eventpb.EventType_TimerCanceled { + if e.GetEventType() == eventpb.EVENT_TYPE_TIMER_CANCELED { eventAttributes := e.GetTimerCanceledEventAttributes() if eventAttributes.GetTimerId() != decisionAttributes.GetTimerId() { return false } - } else if e.GetEventType() == eventpb.EventType_CancelTimerFailed { + } else if e.GetEventType() == eventpb.EVENT_TYPE_CANCEL_TIMER_FAILED { eventAttributes := e.GetCancelTimerFailedEventAttributes() if eventAttributes.GetTimerId() != decisionAttributes.GetTimerId() { return false @@ -1281,8 +1281,8 @@ func isDecisionMatchEvent(d *decisionpb.Decision, e *eventpb.HistoryEvent, stric return true - case decisionpb.DecisionType_CompleteWorkflowExecution: - if e.GetEventType() != eventpb.EventType_WorkflowExecutionCompleted { + case decisionpb.DECISION_TYPE_COMPLETE_WORKFLOW_EXECUTION: + if e.GetEventType() != eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED { return false } if strictMode { @@ -1296,8 +1296,8 @@ func isDecisionMatchEvent(d *decisionpb.Decision, e *eventpb.HistoryEvent, stric return true - case decisionpb.DecisionType_FailWorkflowExecution: - if e.GetEventType() != eventpb.EventType_WorkflowExecutionFailed { + case decisionpb.DECISION_TYPE_FAIL_WORKFLOW_EXECUTION: + if e.GetEventType() != eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_FAILED { return false } if strictMode { @@ -1311,8 +1311,8 @@ func isDecisionMatchEvent(d *decisionpb.Decision, e *eventpb.HistoryEvent, stric return true - case decisionpb.DecisionType_RecordMarker: - if e.GetEventType() != eventpb.EventType_MarkerRecorded { + case decisionpb.DECISION_TYPE_RECORD_MARKER: + if e.GetEventType() != eventpb.EVENT_TYPE_MARKER_RECORDED { return false } eventAttributes := e.GetMarkerRecordedEventAttributes() @@ -1323,8 +1323,8 @@ func isDecisionMatchEvent(d *decisionpb.Decision, e *eventpb.HistoryEvent, stric return true - case decisionpb.DecisionType_RequestCancelExternalWorkflowExecution: - if e.GetEventType() != eventpb.EventType_RequestCancelExternalWorkflowExecutionInitiated { + case decisionpb.DECISION_TYPE_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION: + if e.GetEventType() != eventpb.EVENT_TYPE_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_INITIATED { return false } eventAttributes := e.GetRequestCancelExternalWorkflowExecutionInitiatedEventAttributes() @@ -1336,8 +1336,8 @@ func isDecisionMatchEvent(d *decisionpb.Decision, e *eventpb.HistoryEvent, stric return true - case decisionpb.DecisionType_SignalExternalWorkflowExecution: - if e.GetEventType() != eventpb.EventType_SignalExternalWorkflowExecutionInitiated { + case decisionpb.DECISION_TYPE_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION: + if e.GetEventType() != eventpb.EVENT_TYPE_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_INITIATED { return false } eventAttributes := e.GetSignalExternalWorkflowExecutionInitiatedEventAttributes() @@ -1350,8 +1350,8 @@ func isDecisionMatchEvent(d *decisionpb.Decision, e *eventpb.HistoryEvent, stric return true - case decisionpb.DecisionType_CancelWorkflowExecution: - if e.GetEventType() != eventpb.EventType_WorkflowExecutionCanceled { + case decisionpb.DECISION_TYPE_CANCEL_WORKFLOW_EXECUTION: + if e.GetEventType() != eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_CANCELED { return false } if strictMode { @@ -1363,15 +1363,15 @@ func isDecisionMatchEvent(d *decisionpb.Decision, e *eventpb.HistoryEvent, stric } return true - case decisionpb.DecisionType_ContinueAsNewWorkflowExecution: - if e.GetEventType() != eventpb.EventType_WorkflowExecutionContinuedAsNew { + case decisionpb.DECISION_TYPE_CONTINUE_AS_NEW_WORKFLOW_EXECUTION: + if e.GetEventType() != eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_CONTINUED_AS_NEW { return false } return true - case decisionpb.DecisionType_StartChildWorkflowExecution: - if e.GetEventType() != eventpb.EventType_StartChildWorkflowExecutionInitiated { + case decisionpb.DECISION_TYPE_START_CHILD_WORKFLOW_EXECUTION: + if e.GetEventType() != eventpb.EVENT_TYPE_START_CHILD_WORKFLOW_EXECUTION_INITIATED { return false } eventAttributes := e.GetStartChildWorkflowExecutionInitiatedEventAttributes() @@ -1384,8 +1384,8 @@ func isDecisionMatchEvent(d *decisionpb.Decision, e *eventpb.HistoryEvent, stric return true - case decisionpb.DecisionType_UpsertWorkflowSearchAttributes: - if e.GetEventType() != eventpb.EventType_UpsertWorkflowSearchAttributes { + case decisionpb.DECISION_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES: + if e.GetEventType() != eventpb.EVENT_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES { return false } eventAttributes := e.GetUpsertWorkflowSearchAttributesEventAttributes() @@ -1429,17 +1429,17 @@ func (wth *workflowTaskHandlerImpl) completeWorkflow( queryCompletedRequest := &workflowservice.RespondQueryTaskCompletedRequest{TaskToken: task.TaskToken} var panicErr *PanicError if errors.As(workflowContext.err, &panicErr) { - queryCompletedRequest.CompletedType = querypb.QueryResultType_Failed + queryCompletedRequest.CompletedType = querypb.QUERY_RESULT_TYPE_FAILED queryCompletedRequest.ErrorMessage = "Workflow panic: " + panicErr.Error() return queryCompletedRequest } result, err := eventHandler.ProcessQuery(task.Query.GetQueryType(), task.Query.QueryArgs) if err != nil { - queryCompletedRequest.CompletedType = querypb.QueryResultType_Failed + queryCompletedRequest.CompletedType = querypb.QUERY_RESULT_TYPE_FAILED queryCompletedRequest.ErrorMessage = err.Error() } else { - queryCompletedRequest.CompletedType = querypb.QueryResultType_Answered + queryCompletedRequest.CompletedType = querypb.QUERY_RESULT_TYPE_ANSWERED queryCompletedRequest.QueryResult = result } return queryCompletedRequest @@ -1468,14 +1468,14 @@ func (wth *workflowTaskHandlerImpl) completeWorkflow( if errors.As(workflowContext.err, &canceledErr) { // Workflow cancelled metricsScope.Counter(metrics.WorkflowCanceledCounter).Inc(1) - closeDecision = createNewDecision(decisionpb.DecisionType_CancelWorkflowExecution) + closeDecision = createNewDecision(decisionpb.DECISION_TYPE_CANCEL_WORKFLOW_EXECUTION) closeDecision.Attributes = &decisionpb.Decision_CancelWorkflowExecutionDecisionAttributes{CancelWorkflowExecutionDecisionAttributes: &decisionpb.CancelWorkflowExecutionDecisionAttributes{ Details: convertErrDetailsToPayloads(canceledErr.details, wth.dataConverter), }} } else if errors.As(workflowContext.err, &contErr) { // Continue as new error. metricsScope.Counter(metrics.WorkflowContinueAsNewCounter).Inc(1) - closeDecision = createNewDecision(decisionpb.DecisionType_ContinueAsNewWorkflowExecution) + closeDecision = createNewDecision(decisionpb.DECISION_TYPE_CONTINUE_AS_NEW_WORKFLOW_EXECUTION) closeDecision.Attributes = &decisionpb.Decision_ContinueAsNewWorkflowExecutionDecisionAttributes{ContinueAsNewWorkflowExecutionDecisionAttributes: &decisionpb.ContinueAsNewWorkflowExecutionDecisionAttributes{ WorkflowType: &commonpb.WorkflowType{Name: contErr.params.WorkflowType.Name}, Input: contErr.params.Input, @@ -1489,7 +1489,7 @@ func (wth *workflowTaskHandlerImpl) completeWorkflow( } else if workflowContext.err != nil { // Workflow failures metricsScope.Counter(metrics.WorkflowFailedCounter).Inc(1) - closeDecision = createNewDecision(decisionpb.DecisionType_FailWorkflowExecution) + closeDecision = createNewDecision(decisionpb.DECISION_TYPE_FAIL_WORKFLOW_EXECUTION) failure := convertErrorToFailure(workflowContext.err, wth.dataConverter) closeDecision.Attributes = &decisionpb.Decision_FailWorkflowExecutionDecisionAttributes{FailWorkflowExecutionDecisionAttributes: &decisionpb.FailWorkflowExecutionDecisionAttributes{ Failure: failure, @@ -1497,7 +1497,7 @@ func (wth *workflowTaskHandlerImpl) completeWorkflow( } else if workflowContext.isWorkflowCompleted { // Workflow completion metricsScope.Counter(metrics.WorkflowCompletedCounter).Inc(1) - closeDecision = createNewDecision(decisionpb.DecisionType_CompleteWorkflowExecution) + closeDecision = createNewDecision(decisionpb.DECISION_TYPE_COMPLETE_WORKFLOW_EXECUTION) closeDecision.Attributes = &decisionpb.Decision_CompleteWorkflowExecutionDecisionAttributes{CompleteWorkflowExecutionDecisionAttributes: &decisionpb.CompleteWorkflowExecutionDecisionAttributes{ Result: workflowContext.result, }} @@ -1517,12 +1517,12 @@ func (wth *workflowTaskHandlerImpl) completeWorkflow( result, err := eventHandler.ProcessQuery(query.GetQueryType(), query.QueryArgs) if err != nil { queryResults[queryID] = &querypb.WorkflowQueryResult{ - ResultType: querypb.QueryResultType_Failed, + ResultType: querypb.QUERY_RESULT_TYPE_FAILED, ErrorMessage: err.Error(), } } else { queryResults[queryID] = &querypb.WorkflowQueryResult{ - ResultType: querypb.QueryResultType_Answered, + ResultType: querypb.QUERY_RESULT_TYPE_ANSWERED, Answer: result, } } @@ -1543,7 +1543,7 @@ func (wth *workflowTaskHandlerImpl) completeWorkflow( func errorToFailDecisionTask(taskToken []byte, err error, identity string, dataConverter DataConverter) *workflowservice.RespondDecisionTaskFailedRequest { return &workflowservice.RespondDecisionTaskFailedRequest{ TaskToken: taskToken, - Cause: eventpb.DecisionTaskFailedCause_WorkflowWorkerUnhandledFailure, + Cause: eventpb.DECISION_TASK_FAILED_CAUSE_WORKFLOW_WORKER_UNHANDLED_FAILURE, Failure: convertErrorToFailure(err, dataConverter), Identity: identity, BinaryChecksum: getBinaryChecksum(), @@ -1553,13 +1553,13 @@ func errorToFailDecisionTask(taskToken []byte, err error, identity string, dataC func (wth *workflowTaskHandlerImpl) executeAnyPressurePoints(event *eventpb.HistoryEvent, isInReplay bool) error { if wth.ppMgr != nil && !reflect.ValueOf(wth.ppMgr).IsNil() && !isInReplay { switch event.GetEventType() { - case eventpb.EventType_DecisionTaskStarted: + case eventpb.EVENT_TYPE_DECISION_TASK_STARTED: return wth.ppMgr.Execute(pressurePointTypeDecisionTaskStartTimeout) - case eventpb.EventType_ActivityTaskScheduled: + case eventpb.EVENT_TYPE_ACTIVITY_TASK_SCHEDULED: return wth.ppMgr.Execute(pressurePointTypeActivityTaskScheduleTimeout) - case eventpb.EventType_ActivityTaskStarted: + case eventpb.EVENT_TYPE_ACTIVITY_TASK_STARTED: return wth.ppMgr.Execute(pressurePointTypeActivityTaskStartTimeout) - case eventpb.EventType_DecisionTaskCompleted: + case eventpb.EVENT_TYPE_DECISION_TASK_COMPLETED: return wth.ppMgr.Execute(pressurePointTypeDecisionTaskCompleted) } } diff --git a/internal/internal_task_handlers_interfaces_test.go b/internal/internal_task_handlers_interfaces_test.go index 1aa29f08a..7ec6c951b 100644 --- a/internal/internal_task_handlers_interfaces_test.go +++ b/internal/internal_task_handlers_interfaces_test.go @@ -155,11 +155,11 @@ func (s *PollLayerInterfacesTestSuite) TestGetNextDecisions() { createTestEventDecisionTaskStarted(3), { EventId: 4, - EventType: eventpb.EventType_DecisionTaskFailed, + EventType: eventpb.EVENT_TYPE_DECISION_TASK_FAILED, }, { EventId: 5, - EventType: eventpb.EventType_WorkflowExecutionSignaled, + EventType: eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_SIGNALED, }, createTestEventDecisionTaskScheduled(6, &eventpb.DecisionTaskScheduledEventAttributes{TaskList: &tasklistpb.TaskList{Name: taskList}}), createTestEventDecisionTaskStarted(7), @@ -183,7 +183,7 @@ func (s *PollLayerInterfacesTestSuite) TestGetNextDecisions() { s.NoError(err) s.Equal(3, len(events)) - s.Equal(eventpb.EventType_WorkflowExecutionSignaled, events[1].GetEventType()) - s.Equal(eventpb.EventType_DecisionTaskStarted, events[2].GetEventType()) + s.Equal(eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_SIGNALED, events[1].GetEventType()) + s.Equal(eventpb.EVENT_TYPE_DECISION_TASK_STARTED, events[2].GetEventType()) s.Equal(int64(7), events[2].GetEventId()) } diff --git a/internal/internal_task_handlers_test.go b/internal/internal_task_handlers_test.go index d91f8e694..3b8d4482e 100644 --- a/internal/internal_task_handlers_test.go +++ b/internal/internal_task_handlers_test.go @@ -137,63 +137,63 @@ func TestTaskHandlersTestSuite(t *testing.T) { func createTestEventWorkflowExecutionCompleted(eventID int64, attr *eventpb.WorkflowExecutionCompletedEventAttributes) *eventpb.HistoryEvent { return &eventpb.HistoryEvent{ EventId: eventID, - EventType: eventpb.EventType_WorkflowExecutionCompleted, + EventType: eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED, Attributes: &eventpb.HistoryEvent_WorkflowExecutionCompletedEventAttributes{WorkflowExecutionCompletedEventAttributes: attr}} } func createTestEventWorkflowExecutionStarted(eventID int64, attr *eventpb.WorkflowExecutionStartedEventAttributes) *eventpb.HistoryEvent { return &eventpb.HistoryEvent{ EventId: eventID, - EventType: eventpb.EventType_WorkflowExecutionStarted, + EventType: eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_STARTED, Attributes: &eventpb.HistoryEvent_WorkflowExecutionStartedEventAttributes{WorkflowExecutionStartedEventAttributes: attr}} } func createTestEventLocalActivity(eventID int64, attr *eventpb.MarkerRecordedEventAttributes) *eventpb.HistoryEvent { return &eventpb.HistoryEvent{ EventId: eventID, - EventType: eventpb.EventType_MarkerRecorded, + EventType: eventpb.EVENT_TYPE_MARKER_RECORDED, Attributes: &eventpb.HistoryEvent_MarkerRecordedEventAttributes{MarkerRecordedEventAttributes: attr}} } func createTestEventActivityTaskScheduled(eventID int64, attr *eventpb.ActivityTaskScheduledEventAttributes) *eventpb.HistoryEvent { return &eventpb.HistoryEvent{ EventId: eventID, - EventType: eventpb.EventType_ActivityTaskScheduled, + EventType: eventpb.EVENT_TYPE_ACTIVITY_TASK_SCHEDULED, Attributes: &eventpb.HistoryEvent_ActivityTaskScheduledEventAttributes{ActivityTaskScheduledEventAttributes: attr}} } func createTestEventActivityTaskStarted(eventID int64, attr *eventpb.ActivityTaskStartedEventAttributes) *eventpb.HistoryEvent { return &eventpb.HistoryEvent{ EventId: eventID, - EventType: eventpb.EventType_ActivityTaskStarted, + EventType: eventpb.EVENT_TYPE_ACTIVITY_TASK_STARTED, Attributes: &eventpb.HistoryEvent_ActivityTaskStartedEventAttributes{ActivityTaskStartedEventAttributes: attr}} } func createTestEventActivityTaskCompleted(eventID int64, attr *eventpb.ActivityTaskCompletedEventAttributes) *eventpb.HistoryEvent { return &eventpb.HistoryEvent{ EventId: eventID, - EventType: eventpb.EventType_ActivityTaskCompleted, + EventType: eventpb.EVENT_TYPE_ACTIVITY_TASK_COMPLETED, Attributes: &eventpb.HistoryEvent_ActivityTaskCompletedEventAttributes{ActivityTaskCompletedEventAttributes: attr}} } func createTestEventActivityTaskTimedOut(eventID int64, attr *eventpb.ActivityTaskTimedOutEventAttributes) *eventpb.HistoryEvent { return &eventpb.HistoryEvent{ EventId: eventID, - EventType: eventpb.EventType_ActivityTaskTimedOut, + EventType: eventpb.EVENT_TYPE_ACTIVITY_TASK_TIMED_OUT, Attributes: &eventpb.HistoryEvent_ActivityTaskTimedOutEventAttributes{ActivityTaskTimedOutEventAttributes: attr}} } func createTestEventDecisionTaskScheduled(eventID int64, attr *eventpb.DecisionTaskScheduledEventAttributes) *eventpb.HistoryEvent { return &eventpb.HistoryEvent{ EventId: eventID, - EventType: eventpb.EventType_DecisionTaskScheduled, + EventType: eventpb.EVENT_TYPE_DECISION_TASK_SCHEDULED, Attributes: &eventpb.HistoryEvent_DecisionTaskScheduledEventAttributes{DecisionTaskScheduledEventAttributes: attr}} } func createTestEventDecisionTaskStarted(eventID int64) *eventpb.HistoryEvent { return &eventpb.HistoryEvent{ EventId: eventID, - EventType: eventpb.EventType_DecisionTaskStarted} + EventType: eventpb.EVENT_TYPE_DECISION_TASK_STARTED} } func createTestEventWorkflowExecutionSignaled(eventID int64, signalName string) *eventpb.HistoryEvent { @@ -203,7 +203,7 @@ func createTestEventWorkflowExecutionSignaled(eventID int64, signalName string) func createTestEventWorkflowExecutionSignaledWithPayload(eventID int64, signalName string, payloads *commonpb.Payloads) *eventpb.HistoryEvent { return &eventpb.HistoryEvent{ EventId: eventID, - EventType: eventpb.EventType_WorkflowExecutionSignaled, + EventType: eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_SIGNALED, Attributes: &eventpb.HistoryEvent_WorkflowExecutionSignaledEventAttributes{WorkflowExecutionSignaledEventAttributes: &eventpb.WorkflowExecutionSignaledEventAttributes{ SignalName: signalName, Input: payloads, @@ -215,21 +215,21 @@ func createTestEventWorkflowExecutionSignaledWithPayload(eventID int64, signalNa func createTestEventDecisionTaskCompleted(eventID int64, attr *eventpb.DecisionTaskCompletedEventAttributes) *eventpb.HistoryEvent { return &eventpb.HistoryEvent{ EventId: eventID, - EventType: eventpb.EventType_DecisionTaskCompleted, + EventType: eventpb.EVENT_TYPE_DECISION_TASK_COMPLETED, Attributes: &eventpb.HistoryEvent_DecisionTaskCompletedEventAttributes{DecisionTaskCompletedEventAttributes: attr}} } func createTestEventDecisionTaskFailed(eventID int64, attr *eventpb.DecisionTaskFailedEventAttributes) *eventpb.HistoryEvent { return &eventpb.HistoryEvent{ EventId: eventID, - EventType: eventpb.EventType_DecisionTaskFailed, + EventType: eventpb.EVENT_TYPE_DECISION_TASK_FAILED, Attributes: &eventpb.HistoryEvent_DecisionTaskFailedEventAttributes{DecisionTaskFailedEventAttributes: attr}} } func createTestEventSignalExternalWorkflowExecutionFailed(eventID int64, attr *eventpb.SignalExternalWorkflowExecutionFailedEventAttributes) *eventpb.HistoryEvent { return &eventpb.HistoryEvent{ EventId: eventID, - EventType: eventpb.EventType_SignalExternalWorkflowExecutionFailed, + EventType: eventpb.EVENT_TYPE_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED, Attributes: &eventpb.HistoryEvent_SignalExternalWorkflowExecutionFailedEventAttributes{SignalExternalWorkflowExecutionFailedEventAttributes: attr}} } @@ -246,7 +246,7 @@ func createTestEventVersionMarker(eventID int64, decisionCompletedID int64, chan return &eventpb.HistoryEvent{ EventId: eventID, - EventType: eventpb.EventType_MarkerRecorded, + EventType: eventpb.EVENT_TYPE_MARKER_RECORDED, Attributes: &eventpb.HistoryEvent_MarkerRecordedEventAttributes{ MarkerRecordedEventAttributes: &eventpb.MarkerRecordedEventAttributes{ MarkerName: versionMarkerName, @@ -265,7 +265,7 @@ func createTestUpsertWorkflowSearchAttributesForChangeVersion(eventID int64, dec return &eventpb.HistoryEvent{ EventId: eventID, - EventType: eventpb.EventType_UpsertWorkflowSearchAttributes, + EventType: eventpb.EVENT_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES, Attributes: &eventpb.HistoryEvent_UpsertWorkflowSearchAttributesEventAttributes{ UpsertWorkflowSearchAttributesEventAttributes: &eventpb.UpsertWorkflowSearchAttributesEventAttributes{ SearchAttributes: searchAttributes, @@ -332,7 +332,7 @@ func createTestEventTimerStarted(eventID int64, id int) *eventpb.HistoryEvent { } return &eventpb.HistoryEvent{ EventId: eventID, - EventType: eventpb.EventType_TimerStarted, + EventType: eventpb.EVENT_TYPE_TIMER_STARTED, Attributes: &eventpb.HistoryEvent_TimerStartedEventAttributes{TimerStartedEventAttributes: attr}} } @@ -344,7 +344,7 @@ func createTestEventTimerFired(eventID int64, id int) *eventpb.HistoryEvent { return &eventpb.HistoryEvent{ EventId: eventID, - EventType: eventpb.EventType_TimerFired, + EventType: eventpb.EVENT_TYPE_TIMER_FIRED, Attributes: &eventpb.HistoryEvent_TimerFiredEventAttributes{TimerFiredEventAttributes: attr}} } @@ -361,7 +361,7 @@ func (t *TaskHandlersTestSuite) testWorkflowTaskWorkflowExecutionStartedHelper(p t.NoError(err) t.NotNil(response) t.Equal(1, len(response.Decisions)) - t.Equal(decisionpb.DecisionType_ScheduleActivityTask, response.Decisions[0].GetDecisionType()) + t.Equal(decisionpb.DECISION_TYPE_SCHEDULE_ACTIVITY_TASK, response.Decisions[0].GetDecisionType()) t.NotNil(response.Decisions[0].GetScheduleActivityTaskDecisionAttributes()) } @@ -417,7 +417,7 @@ func (t *TaskHandlersTestSuite) TestWorkflowTask_BinaryChecksum() { t.NoError(err) t.NotNil(response) t.Equal(1, len(response.Decisions)) - t.Equal(decisionpb.DecisionType_CompleteWorkflowExecution, response.Decisions[0].GetDecisionType()) + t.Equal(decisionpb.DECISION_TYPE_COMPLETE_WORKFLOW_EXECUTION, response.Decisions[0].GetDecisionType()) checksumsPayload := response.Decisions[0].GetCompleteWorkflowExecutionDecisionAttributes().GetResult() var checksums []string _ = DefaultDataConverter.FromPayloads(checksumsPayload, &checksums) @@ -458,7 +458,7 @@ func (t *TaskHandlersTestSuite) TestWorkflowTask_ActivityTaskScheduled() { t.NoError(err) t.NotNil(response) t.Equal(1, len(response.Decisions)) - t.Equal(decisionpb.DecisionType_ScheduleActivityTask, response.Decisions[0].GetDecisionType()) + t.Equal(decisionpb.DECISION_TYPE_SCHEDULE_ACTIVITY_TASK, response.Decisions[0].GetDecisionType()) t.NotNil(response.Decisions[0].GetScheduleActivityTaskDecisionAttributes()) // Schedule an activity and see if we complete workflow, Having only one last decision. @@ -468,7 +468,7 @@ func (t *TaskHandlersTestSuite) TestWorkflowTask_ActivityTaskScheduled() { t.NoError(err) t.NotNil(response) t.Equal(1, len(response.Decisions)) - t.Equal(decisionpb.DecisionType_CompleteWorkflowExecution, response.Decisions[0].GetDecisionType()) + t.Equal(decisionpb.DECISION_TYPE_COMPLETE_WORKFLOW_EXECUTION, response.Decisions[0].GetDecisionType()) t.NotNil(response.Decisions[0].GetCompleteWorkflowExecutionDecisionAttributes()) } @@ -509,7 +509,7 @@ func (t *TaskHandlersTestSuite) TestWorkflowTask_QueryWorkflow_Sticky() { t.NoError(err) t.NotNil(response) t.Equal(1, len(response.Decisions)) - t.Equal(decisionpb.DecisionType_ScheduleActivityTask, response.Decisions[0].GetDecisionType()) + t.Equal(decisionpb.DECISION_TYPE_SCHEDULE_ACTIVITY_TASK, response.Decisions[0].GetDecisionType()) t.NotNil(response.Decisions[0].GetScheduleActivityTaskDecisionAttributes()) // then check the current state using query task @@ -847,7 +847,7 @@ func (t *TaskHandlersTestSuite) TestWorkflowTask_NondeterministicDetection() { // and contains proper justification.(i.e. nondeterminism). t.True(len(response.Decisions) > 0) closeDecision := response.Decisions[len(response.Decisions)-1] - t.Equal(closeDecision.DecisionType, decisionpb.DecisionType_FailWorkflowExecution) + t.Equal(closeDecision.DecisionType, decisionpb.DECISION_TYPE_FAIL_WORKFLOW_EXECUTION) t.Contains(closeDecision.GetFailWorkflowExecutionDecisionAttributes().GetFailure().GetMessage(), "FailWorkflow") // now with different package name to activity type @@ -880,7 +880,7 @@ func (t *TaskHandlersTestSuite) TestWorkflowTask_WorkflowReturnsPanicError() { t.NotNil(request) r, ok := request.(*workflowservice.RespondDecisionTaskCompletedRequest) t.True(ok) - t.EqualValues(decisionpb.DecisionType_FailWorkflowExecution, r.Decisions[0].GetDecisionType()) + t.EqualValues(decisionpb.DECISION_TYPE_FAIL_WORKFLOW_EXECUTION, r.Decisions[0].GetDecisionType()) attr := r.Decisions[0].GetFailWorkflowExecutionDecisionAttributes() t.EqualValues("panicError", attr.GetFailure().GetMessage()) t.NotNil(attr.GetFailure().GetApplicationFailureInfo()) @@ -907,7 +907,7 @@ func (t *TaskHandlersTestSuite) TestWorkflowTask_WorkflowPanics() { t.NotNil(request) r, ok := request.(*workflowservice.RespondDecisionTaskFailedRequest) t.True(ok) - t.EqualValues(eventpb.DecisionTaskFailedCause_WorkflowWorkerUnhandledFailure, r.Cause) + t.EqualValues(eventpb.DECISION_TASK_FAILED_CAUSE_WORKFLOW_WORKER_UNHANDLED_FAILURE, r.Cause) t.NotNil(r.GetFailure().GetApplicationFailureInfo()) t.Equal("PanicError", r.GetFailure().GetApplicationFailureInfo().GetType()) t.Equal("panicError", r.GetFailure().GetMessage()) @@ -962,7 +962,7 @@ func (t *TaskHandlersTestSuite) TestGetWorkflowInfo() { t.NotNil(request) r, ok := request.(*workflowservice.RespondDecisionTaskCompletedRequest) t.True(ok) - t.EqualValues(decisionpb.DecisionType_CompleteWorkflowExecution, r.Decisions[0].GetDecisionType()) + t.EqualValues(decisionpb.DECISION_TYPE_COMPLETE_WORKFLOW_EXECUTION, r.Decisions[0].GetDecisionType()) attr := r.Decisions[0].GetCompleteWorkflowExecutionDecisionAttributes() var result WorkflowInfo t.NoError(getDefaultDataConverter().FromPayloads(attr.Result, &result)) @@ -1052,11 +1052,11 @@ func (t *TaskHandlersTestSuite) TestConsistentQuery_Success() { answer, _ := DefaultDataConverter.ToPayloads(startingQueryValue) expectedQueryResults := map[string]*querypb.WorkflowQueryResult{ "id1": { - ResultType: querypb.QueryResultType_Answered, + ResultType: querypb.QUERY_RESULT_TYPE_ANSWERED, Answer: answer, }, "id2": { - ResultType: querypb.QueryResultType_Failed, + ResultType: querypb.QUERY_RESULT_TYPE_FAILED, ErrorMessage: queryErr, }, } @@ -1072,11 +1072,11 @@ func (t *TaskHandlersTestSuite) TestConsistentQuery_Success() { answer, _ = DefaultDataConverter.ToPayloads("signal data") expectedQueryResults = map[string]*querypb.WorkflowQueryResult{ "id1": { - ResultType: querypb.QueryResultType_Answered, + ResultType: querypb.QUERY_RESULT_TYPE_ANSWERED, Answer: answer, }, "id2": { - ResultType: querypb.QueryResultType_Failed, + ResultType: querypb.QUERY_RESULT_TYPE_FAILED, ErrorMessage: queryErr, }, } @@ -1116,7 +1116,7 @@ func (t *TaskHandlersTestSuite) TestWorkflowTask_CancelActivityBeforeSent() { t.NoError(err) t.NotNil(response) t.Equal(1, len(response.Decisions)) - t.Equal(decisionpb.DecisionType_CompleteWorkflowExecution, response.Decisions[0].GetDecisionType()) + t.Equal(decisionpb.DECISION_TYPE_COMPLETE_WORKFLOW_EXECUTION, response.Decisions[0].GetDecisionType()) t.NotNil(response.Decisions[0].GetCompleteWorkflowExecutionDecisionAttributes()) } @@ -1462,8 +1462,8 @@ func Test_NonDeterministicCheck(t *testing.T) { } func Test_IsDecisionMatchEvent_UpsertWorkflowSearchAttributes(t *testing.T) { - diType := decisionpb.DecisionType_UpsertWorkflowSearchAttributes - eType := eventpb.EventType_UpsertWorkflowSearchAttributes + diType := decisionpb.DECISION_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES + eType := eventpb.EVENT_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES strictMode := false testCases := []struct { diff --git a/internal/internal_task_pollers.go b/internal/internal_task_pollers.go index 5c96fac4d..0313b50a9 100644 --- a/internal/internal_task_pollers.go +++ b/internal/internal_task_pollers.go @@ -588,7 +588,7 @@ func (wtp *workflowTaskPoller) release(kind tasklistpb.TaskListKind) { } wtp.requestLock.Lock() - if kind == tasklistpb.TaskListKind_Sticky { + if kind == tasklistpb.TASK_LIST_KIND_STICKY { wtp.pendingStickyPollCount-- } else { wtp.pendingRegularPollCount-- @@ -597,7 +597,7 @@ func (wtp *workflowTaskPoller) release(kind tasklistpb.TaskListKind) { } func (wtp *workflowTaskPoller) updateBacklog(taskListKind tasklistpb.TaskListKind, backlogCountHint int64) { - if taskListKind == tasklistpb.TaskListKind_Normal || wtp.disableStickyExecution { + if taskListKind == tasklistpb.TASK_LIST_KIND_NORMAL || wtp.disableStickyExecution { // we only care about sticky backlog for now. return } @@ -615,13 +615,13 @@ func (wtp *workflowTaskPoller) updateBacklog(taskListKind tasklistpb.TaskListKin // TODO: make this more smart to auto adjust based on poll latency func (wtp *workflowTaskPoller) getNextPollRequest() (request *workflowservice.PollForDecisionTaskRequest) { taskListName := wtp.taskListName - taskListKind := tasklistpb.TaskListKind_Normal + taskListKind := tasklistpb.TASK_LIST_KIND_NORMAL if !wtp.disableStickyExecution { wtp.requestLock.Lock() if wtp.stickyBacklog > 0 || wtp.pendingStickyPollCount <= wtp.pendingRegularPollCount { wtp.pendingStickyPollCount++ taskListName = getWorkerTaskList(wtp.stickyUUID) - taskListKind = tasklistpb.TaskListKind_Sticky + taskListKind = tasklistpb.TASK_LIST_KIND_STICKY } else { wtp.pendingRegularPollCount++ } @@ -772,7 +772,7 @@ func newGetHistoryPageFunc( if resp.RawHistory != nil { var err1 error - h, err1 = serializer.DeserializeBlobDataToHistoryEvents(resp.RawHistory, filterpb.HistoryEventFilterType_AllEvent) + h, err1 = serializer.DeserializeBlobDataToHistoryEvents(resp.RawHistory, filterpb.HISTORY_EVENT_FILTER_TYPE_ALL_EVENT) if err1 != nil { return nil, nil, nil } @@ -785,7 +785,7 @@ func newGetHistoryPageFunc( h.Events[size-1].GetEventId() > atDecisionTaskCompletedEventID { first := h.Events[0].GetEventId() // eventIds start from 1 h.Events = h.Events[:atDecisionTaskCompletedEventID-first+1] - if h.Events[len(h.Events)-1].GetEventType() != eventpb.EventType_DecisionTaskCompleted { + if h.Events[len(h.Events)-1].GetEventType() != eventpb.EVENT_TYPE_DECISION_TASK_COMPLETED { return nil, nil, fmt.Errorf("newGetHistoryPageFunc: atDecisionTaskCompletedEventID(%v) "+ "points to event that is not DecisionTaskCompleted", atDecisionTaskCompletedEventID) } diff --git a/internal/internal_utils_test.go b/internal/internal_utils_test.go index 46006d95f..6a6219a33 100644 --- a/internal/internal_utils_test.go +++ b/internal/internal_utils_test.go @@ -125,18 +125,18 @@ func TestConvertErrorToFailure_TimeoutError(t *testing.T) { require.NoError(t, err) val := newEncodedValues(details, dc).(*EncodedValues) - timeoutErr1 := NewTimeoutError(commonpb.TimeoutType_ScheduleToStart, nil, val) + timeoutErr1 := NewTimeoutError(commonpb.TIMEOUT_TYPE_SCHEDULE_TO_START, nil, val) failure := convertErrorToFailure(timeoutErr1, dc) require.NotNil(t, failure.GetTimeoutFailureInfo()) - require.Equal(t, commonpb.TimeoutType_ScheduleToStart, failure.GetTimeoutFailureInfo().GetTimeoutType()) + require.Equal(t, commonpb.TIMEOUT_TYPE_SCHEDULE_TO_START, failure.GetTimeoutFailureInfo().GetTimeoutType()) require.Equal(t, val.values, failure.GetTimeoutFailureInfo().GetLastHeartbeatDetails()) - timeoutErr2 := NewTimeoutError(commonpb.TimeoutType_Heartbeat, nil, testErrorDetails4) + timeoutErr2 := NewTimeoutError(commonpb.TIMEOUT_TYPE_HEARTBEAT, nil, testErrorDetails4) val2, err := encodeArgs(dc, []interface{}{testErrorDetails4}) require.NoError(t, err) failure = convertErrorToFailure(timeoutErr2, dc) require.NotNil(t, failure.GetTimeoutFailureInfo()) - require.Equal(t, commonpb.TimeoutType_Heartbeat, failure.GetTimeoutFailureInfo().GetTimeoutType()) + require.Equal(t, commonpb.TIMEOUT_TYPE_HEARTBEAT, failure.GetTimeoutFailureInfo().GetTimeoutType()) require.Equal(t, val2, failure.GetTimeoutFailureInfo().GetLastHeartbeatDetails()) } @@ -148,7 +148,7 @@ func TestConvertFailureToError_TimeoutError(t *testing.T) { failure := &failurepb.Failure{ FailureInfo: &failurepb.Failure_TimeoutFailureInfo{TimeoutFailureInfo: &failurepb.TimeoutFailureInfo{ - TimeoutType: commonpb.TimeoutType_Heartbeat, + TimeoutType: commonpb.TIMEOUT_TYPE_HEARTBEAT, LastHeartbeatDetails: details, }}, } diff --git a/internal/internal_worker.go b/internal/internal_worker.go index 4dc3e7839..0cf1c927a 100644 --- a/internal/internal_worker.go +++ b/internal/internal_worker.go @@ -1205,7 +1205,7 @@ func (aw *WorkflowReplayer) ReplayWorkflowExecution(ctx context.Context, service } if hResponse.RawHistory != nil { - history, err := serializer.DeserializeBlobDataToHistoryEvents(hResponse.RawHistory, filterpb.HistoryEventFilterType_AllEvent) + history, err := serializer.DeserializeBlobDataToHistoryEvents(hResponse.RawHistory, filterpb.HISTORY_EVENT_FILTER_TYPE_ALL_EVENT) if err != nil { return err } @@ -1226,7 +1226,7 @@ func (aw *WorkflowReplayer) replayWorkflowHistory(logger *zap.Logger, service wo return errors.New("at least 3 events expected in the history") } first := events[0] - if first.GetEventType() != eventpb.EventType_WorkflowExecutionStarted { + if first.GetEventType() != eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_STARTED { return errors.New("first event is not WorkflowExecutionStarted") } last := events[len(events)-1] @@ -1277,7 +1277,7 @@ func (aw *WorkflowReplayer) replayWorkflowHistory(logger *zap.Logger, service wo return err } - if last.GetEventType() != eventpb.EventType_WorkflowExecutionCompleted && last.GetEventType() != eventpb.EventType_WorkflowExecutionContinuedAsNew { + if last.GetEventType() != eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED && last.GetEventType() != eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_CONTINUED_AS_NEW { return nil } @@ -1285,8 +1285,8 @@ func (aw *WorkflowReplayer) replayWorkflowHistory(logger *zap.Logger, service wo completeReq, ok := resp.(*workflowservice.RespondDecisionTaskCompletedRequest) if ok { for _, d := range completeReq.Decisions { - if d.GetDecisionType() == decisionpb.DecisionType_ContinueAsNewWorkflowExecution { - if last.GetEventType() == eventpb.EventType_WorkflowExecutionContinuedAsNew { + if d.GetDecisionType() == decisionpb.DECISION_TYPE_CONTINUE_AS_NEW_WORKFLOW_EXECUTION { + if last.GetEventType() == eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_CONTINUED_AS_NEW { inputA := d.GetContinueAsNewWorkflowExecutionDecisionAttributes().GetInput() inputB := last.GetWorkflowExecutionContinuedAsNewEventAttributes().GetInput() if proto.Equal(inputA, inputB) { @@ -1294,8 +1294,8 @@ func (aw *WorkflowReplayer) replayWorkflowHistory(logger *zap.Logger, service wo } } } - if d.GetDecisionType() == decisionpb.DecisionType_CompleteWorkflowExecution { - if last.GetEventType() == eventpb.EventType_WorkflowExecutionCompleted { + if d.GetDecisionType() == decisionpb.DECISION_TYPE_COMPLETE_WORKFLOW_EXECUTION { + if last.GetEventType() == eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED { resultA := last.GetWorkflowExecutionCompletedEventAttributes().GetResult() resultB := d.GetCompleteWorkflowExecutionDecisionAttributes().GetResult() if proto.Equal(resultA, resultB) { diff --git a/internal/internal_worker_interfaces_test.go b/internal/internal_worker_interfaces_test.go index e424f0334..a07e65168 100644 --- a/internal/internal_worker_interfaces_test.go +++ b/internal/internal_worker_interfaces_test.go @@ -188,7 +188,7 @@ func (s *InterfacesTestSuite) TestInterface() { Tracer: opentracing.NoopTracer{}, } - namespaceStatus := namespacepb.NamespaceStatus_Registered + namespaceStatus := namespacepb.NAMESPACE_STATUS_REGISTERED namespaceDesc := &workflowservice.DescribeNamespaceResponse{ NamespaceInfo: &namespacepb.NamespaceInfo{ Name: namespace, diff --git a/internal/internal_worker_test.go b/internal/internal_worker_test.go index 8cee299f7..18fd9564e 100644 --- a/internal/internal_worker_test.go +++ b/internal/internal_worker_test.go @@ -819,7 +819,7 @@ func createWorkerWithThrottle( service *workflowservicemock.MockWorkflowServiceClient, activitiesPerSecond float64, dc DataConverter, ) *AggregatedWorker { namespace := "testNamespace" - namespaceStatus := namespacepb.NamespaceStatus_Registered + namespaceStatus := namespacepb.NAMESPACE_STATUS_REGISTERED namespaceDesc := &workflowservice.DescribeNamespaceResponse{ NamespaceInfo: &namespacepb.NamespaceInfo{ Name: namespace, diff --git a/internal/internal_workers_test.go b/internal/internal_workers_test.go index 5c9c319d8..5a43cbc57 100644 --- a/internal/internal_workers_test.go +++ b/internal/internal_workers_test.go @@ -244,7 +244,7 @@ func (s *WorkersTestSuite) TestLongRunningDecisionTask() { testEvents := []*eventpb.HistoryEvent{ { EventId: 1, - EventType: eventpb.EventType_WorkflowExecutionStarted, + EventType: eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_STARTED, Attributes: &eventpb.HistoryEvent_WorkflowExecutionStartedEventAttributes{WorkflowExecutionStartedEventAttributes: &eventpb.WorkflowExecutionStartedEventAttributes{ TaskList: &tasklistpb.TaskList{Name: taskList}, WorkflowExecutionTimeoutSeconds: 10, @@ -258,7 +258,7 @@ func (s *WorkersTestSuite) TestLongRunningDecisionTask() { createTestEventDecisionTaskCompleted(4, &eventpb.DecisionTaskCompletedEventAttributes{ScheduledEventId: 2}), { EventId: 5, - EventType: eventpb.EventType_MarkerRecorded, + EventType: eventpb.EVENT_TYPE_MARKER_RECORDED, Attributes: &eventpb.HistoryEvent_MarkerRecordedEventAttributes{MarkerRecordedEventAttributes: &eventpb.MarkerRecordedEventAttributes{ MarkerName: localActivityMarkerName, Details: s.createLocalActivityMarkerDataForTest("0"), @@ -270,7 +270,7 @@ func (s *WorkersTestSuite) TestLongRunningDecisionTask() { createTestEventDecisionTaskCompleted(8, &eventpb.DecisionTaskCompletedEventAttributes{ScheduledEventId: 2}), { EventId: 9, - EventType: eventpb.EventType_MarkerRecorded, + EventType: eventpb.EVENT_TYPE_MARKER_RECORDED, Attributes: &eventpb.HistoryEvent_MarkerRecordedEventAttributes{MarkerRecordedEventAttributes: &eventpb.MarkerRecordedEventAttributes{ MarkerName: localActivityMarkerName, Details: s.createLocalActivityMarkerDataForTest("1"), @@ -306,15 +306,15 @@ func (s *WorkersTestSuite) TestLongRunningDecisionTask() { switch respondCounter { case 1: s.Equal(1, len(request.Decisions)) - s.Equal(decisionpb.DecisionType_RecordMarker, request.Decisions[0].GetDecisionType()) + s.Equal(decisionpb.DECISION_TYPE_RECORD_MARKER, request.Decisions[0].GetDecisionType()) task.PreviousStartedEventId = 3 task.StartedEventId = 7 task.History.Events = testEvents[3:7] return &workflowservice.RespondDecisionTaskCompletedResponse{DecisionTask: task}, nil case 2: s.Equal(2, len(request.Decisions)) - s.Equal(decisionpb.DecisionType_RecordMarker, request.Decisions[0].GetDecisionType()) - s.Equal(decisionpb.DecisionType_CompleteWorkflowExecution, request.Decisions[1].GetDecisionType()) + s.Equal(decisionpb.DECISION_TYPE_RECORD_MARKER, request.Decisions[0].GetDecisionType()) + s.Equal(decisionpb.DECISION_TYPE_COMPLETE_WORKFLOW_EXECUTION, request.Decisions[1].GetDecisionType()) task.PreviousStartedEventId = 7 task.StartedEventId = 11 task.History.Events = testEvents[7:11] @@ -385,7 +385,7 @@ func (s *WorkersTestSuite) TestMultipleLocalActivities() { testEvents := []*eventpb.HistoryEvent{ { EventId: 1, - EventType: eventpb.EventType_WorkflowExecutionStarted, + EventType: eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_STARTED, Attributes: &eventpb.HistoryEvent_WorkflowExecutionStartedEventAttributes{WorkflowExecutionStartedEventAttributes: &eventpb.WorkflowExecutionStartedEventAttributes{ TaskList: &tasklistpb.TaskList{Name: taskList}, WorkflowExecutionTimeoutSeconds: 10, @@ -399,7 +399,7 @@ func (s *WorkersTestSuite) TestMultipleLocalActivities() { createTestEventDecisionTaskCompleted(4, &eventpb.DecisionTaskCompletedEventAttributes{ScheduledEventId: 2}), { EventId: 5, - EventType: eventpb.EventType_MarkerRecorded, + EventType: eventpb.EVENT_TYPE_MARKER_RECORDED, Attributes: &eventpb.HistoryEvent_MarkerRecordedEventAttributes{MarkerRecordedEventAttributes: &eventpb.MarkerRecordedEventAttributes{ MarkerName: localActivityMarkerName, Details: s.createLocalActivityMarkerDataForTest("0"), @@ -411,7 +411,7 @@ func (s *WorkersTestSuite) TestMultipleLocalActivities() { createTestEventDecisionTaskCompleted(8, &eventpb.DecisionTaskCompletedEventAttributes{ScheduledEventId: 2}), { EventId: 9, - EventType: eventpb.EventType_MarkerRecorded, + EventType: eventpb.EVENT_TYPE_MARKER_RECORDED, Attributes: &eventpb.HistoryEvent_MarkerRecordedEventAttributes{MarkerRecordedEventAttributes: &eventpb.MarkerRecordedEventAttributes{ MarkerName: localActivityMarkerName, Details: s.createLocalActivityMarkerDataForTest("1"), @@ -447,7 +447,7 @@ func (s *WorkersTestSuite) TestMultipleLocalActivities() { switch respondCounter { case 1: s.Equal(3, len(request.Decisions)) - s.Equal(decisionpb.DecisionType_RecordMarker, request.Decisions[0].GetDecisionType()) + s.Equal(decisionpb.DECISION_TYPE_RECORD_MARKER, request.Decisions[0].GetDecisionType()) task.PreviousStartedEventId = 3 task.StartedEventId = 7 task.History.Events = testEvents[3:11] diff --git a/internal/internal_workflow_client.go b/internal/internal_workflow_client.go index 4a287fde4..2fa534de8 100644 --- a/internal/internal_workflow_client.go +++ b/internal/internal_workflow_client.go @@ -278,7 +278,7 @@ func (wc *WorkflowClient) ExecuteWorkflow(ctx context.Context, options StartWork } iterFn := func(fnCtx context.Context, fnRunID string) HistoryEventIterator { - return wc.GetWorkflowHistory(fnCtx, workflowID, fnRunID, true, filterpb.HistoryEventFilterType_CloseEvent) + return wc.GetWorkflowHistory(fnCtx, workflowID, fnRunID, true, filterpb.HISTORY_EVENT_FILTER_TYPE_CLOSE_EVENT) } return &workflowRunImpl{ @@ -299,7 +299,7 @@ func (wc *WorkflowClient) ExecuteWorkflow(ctx context.Context, options StartWork func (wc *WorkflowClient) GetWorkflow(_ context.Context, workflowID string, runID string) WorkflowRun { iterFn := func(fnCtx context.Context, fnRunID string) HistoryEventIterator { - return wc.GetWorkflowHistory(fnCtx, workflowID, fnRunID, true, filterpb.HistoryEventFilterType_CloseEvent) + return wc.GetWorkflowHistory(fnCtx, workflowID, fnRunID, true, filterpb.HISTORY_EVENT_FILTER_TYPE_CLOSE_EVENT) } return &workflowRunImpl{ @@ -1100,7 +1100,7 @@ func (workflowRun *workflowRunImpl) Get(ctx context.Context, valuePtr interface{ } switch closeEvent.GetEventType() { - case eventpb.EventType_WorkflowExecutionCompleted: + case eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED: attributes := closeEvent.GetWorkflowExecutionCompletedEventAttributes() if valuePtr == nil || attributes.Result == nil { return nil @@ -1110,18 +1110,18 @@ func (workflowRun *workflowRunImpl) Get(ctx context.Context, valuePtr interface{ return errors.New("value parameter is not a pointer") } return workflowRun.dataConverter.FromPayloads(attributes.Result, valuePtr) - case eventpb.EventType_WorkflowExecutionFailed: + case eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_FAILED: attributes := closeEvent.GetWorkflowExecutionFailedEventAttributes() err = convertFailureToError(attributes.GetFailure(), workflowRun.dataConverter) - case eventpb.EventType_WorkflowExecutionCanceled: + case eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_CANCELED: attributes := closeEvent.GetWorkflowExecutionCanceledEventAttributes() details := newEncodedValues(attributes.Details, workflowRun.dataConverter) err = NewCanceledError(details) - case eventpb.EventType_WorkflowExecutionTerminated: + case eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_TERMINATED: err = newTerminatedError() - case eventpb.EventType_WorkflowExecutionTimedOut: - err = NewTimeoutError(commonpb.TimeoutType_StartToClose, nil) - case eventpb.EventType_WorkflowExecutionContinuedAsNew: + case eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_TIMED_OUT: + err = NewTimeoutError(commonpb.TIMEOUT_TYPE_START_TO_CLOSE, nil) + case eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_CONTINUED_AS_NEW: attributes := closeEvent.GetWorkflowExecutionContinuedAsNewEventAttributes() workflowRun.currentRunID = attributes.GetNewExecutionRunId() return workflowRun.Get(ctx, valuePtr) diff --git a/internal/internal_workflow_client_test.go b/internal/internal_workflow_client_test.go index ed29f6691..28d95d53a 100644 --- a/internal/internal_workflow_client_test.go +++ b/internal/internal_workflow_client_test.go @@ -180,7 +180,7 @@ func (s *historyEventIteratorSuite) TearDownTest() { } func (s *historyEventIteratorSuite) TestIterator_NoError() { - filterType := filterpb.HistoryEventFilterType_AllEvent + filterType := filterpb.HISTORY_EVENT_FILTER_TYPE_ALL_EVENT request1 := getGetWorkflowExecutionHistoryRequest(filterType) response1 := &workflowservice.GetWorkflowExecutionHistoryResponse{ History: &eventpb.History{ @@ -224,7 +224,7 @@ func (s *historyEventIteratorSuite) TestIterator_NoError() { s.workflowServiceClient.EXPECT().GetWorkflowExecutionHistory(gomock.Any(), request3, gomock.Any()).Return(response3, nil).Times(1) var events []*eventpb.HistoryEvent - iter := s.wfClient.GetWorkflowHistory(context.Background(), workflowID, runID, true, filterpb.HistoryEventFilterType_AllEvent) + iter := s.wfClient.GetWorkflowHistory(context.Background(), workflowID, runID, true, filterpb.HISTORY_EVENT_FILTER_TYPE_ALL_EVENT) for iter.HasNext() { event, err := iter.Next() s.Nil(err) @@ -234,7 +234,7 @@ func (s *historyEventIteratorSuite) TestIterator_NoError() { } func (s *historyEventIteratorSuite) TestIterator_NoError_EmptyPage() { - filterType := filterpb.HistoryEventFilterType_AllEvent + filterType := filterpb.HISTORY_EVENT_FILTER_TYPE_ALL_EVENT request1 := getGetWorkflowExecutionHistoryRequest(filterType) response1 := &workflowservice.GetWorkflowExecutionHistoryResponse{ History: &eventpb.History{ @@ -275,7 +275,7 @@ func (s *historyEventIteratorSuite) TestIterator_NoError_EmptyPage() { s.workflowServiceClient.EXPECT().GetWorkflowExecutionHistory(gomock.Any(), request3, gomock.Any()).Return(response3, nil).Times(1) var events []*eventpb.HistoryEvent - iter := s.wfClient.GetWorkflowHistory(context.Background(), workflowID, runID, true, filterpb.HistoryEventFilterType_AllEvent) + iter := s.wfClient.GetWorkflowHistory(context.Background(), workflowID, runID, true, filterpb.HISTORY_EVENT_FILTER_TYPE_ALL_EVENT) for iter.HasNext() { event, err := iter.Next() s.Nil(err) @@ -285,7 +285,7 @@ func (s *historyEventIteratorSuite) TestIterator_NoError_EmptyPage() { } func (s *historyEventIteratorSuite) TestIteratorError() { - filterType := filterpb.HistoryEventFilterType_AllEvent + filterType := filterpb.HISTORY_EVENT_FILTER_TYPE_ALL_EVENT request1 := getGetWorkflowExecutionHistoryRequest(filterType) response1 := &workflowservice.GetWorkflowExecutionHistoryResponse{ History: &eventpb.History{ @@ -301,7 +301,7 @@ func (s *historyEventIteratorSuite) TestIteratorError() { s.workflowServiceClient.EXPECT().GetWorkflowExecutionHistory(gomock.Any(), request1, gomock.Any()).Return(response1, nil).Times(1) - iter := s.wfClient.GetWorkflowHistory(context.Background(), workflowID, runID, true, filterpb.HistoryEventFilterType_AllEvent) + iter := s.wfClient.GetWorkflowHistory(context.Background(), workflowID, runID, true, filterpb.HISTORY_EVENT_FILTER_TYPE_ALL_EVENT) s.True(iter.HasNext()) event, err := iter.Next() @@ -367,8 +367,8 @@ func (s *workflowRunSuite) TestExecuteWorkflow_NoDup_Success() { } s.workflowServiceClient.EXPECT().StartWorkflowExecution(gomock.Any(), gomock.Any()).Return(createResponse, nil).Times(1) - filterType := filterpb.HistoryEventFilterType_CloseEvent - eventType := eventpb.EventType_WorkflowExecutionCompleted + filterType := filterpb.HISTORY_EVENT_FILTER_TYPE_CLOSE_EVENT + eventType := eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED workflowResult := time.Hour * 59 encodedResult, _ := encodeArg(getDefaultDataConverter(), workflowResult) getRequest := getGetWorkflowExecutionHistoryRequest(filterType) @@ -412,8 +412,8 @@ func (s *workflowRunSuite) TestExecuteWorkflow_NoDup_RawHistory_Success() { } s.workflowServiceClient.EXPECT().StartWorkflowExecution(gomock.Any(), gomock.Any(), gomock.Any()).Return(createResponse, nil).Times(1) - filterType := filterpb.HistoryEventFilterType_CloseEvent - eventType := eventpb.EventType_WorkflowExecutionCompleted + filterType := filterpb.HISTORY_EVENT_FILTER_TYPE_CLOSE_EVENT + eventType := eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED workflowResult := time.Hour * 59 encodedResult, _ := encodeArg(getDefaultDataConverter(), workflowResult) events := []*eventpb.HistoryEvent{ @@ -458,7 +458,7 @@ func (s *workflowRunSuite) TestExecuteWorkflowWorkflowExecutionAlreadyStartedErr s.workflowServiceClient.EXPECT().StartWorkflowExecution(gomock.Any(), gomock.Any(), gomock.Any()). Return(nil, serviceerror.NewWorkflowExecutionAlreadyStarted("Already Started", "", runID)).Times(1) - eventType := eventpb.EventType_WorkflowExecutionCompleted + eventType := eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED workflowResult := time.Hour * 59 encodedResult, _ := encodeArg(s.dataConverter, workflowResult) getResponse := &workflowservice.GetWorkflowExecutionHistoryResponse{ @@ -504,7 +504,7 @@ func (s *workflowRunSuite) TestExecuteWorkflowWorkflowExecutionAlreadyStartedErr s.workflowServiceClient.EXPECT().StartWorkflowExecution(gomock.Any(), gomock.Any(), gomock.Any()). Return(nil, serviceerror.NewWorkflowExecutionAlreadyStarted("Already Started", "", runID)).Times(1) - eventType := eventpb.EventType_WorkflowExecutionCompleted + eventType := eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED workflowResult := time.Hour * 59 encodedResult, _ := encodeArg(getDefaultDataConverter(), workflowResult) events := []*eventpb.HistoryEvent{ @@ -559,7 +559,7 @@ func (s *workflowRunSuite) TestExecuteWorkflow_NoIdInOptions() { } s.workflowServiceClient.EXPECT().StartWorkflowExecution(gomock.Any(), gomock.Any(), gomock.Any()).Return(createResponse, nil).Times(1) - eventType := eventpb.EventType_WorkflowExecutionCompleted + eventType := eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED workflowResult := time.Hour * 59 encodedResult, _ := encodeArg(s.dataConverter, workflowResult) getResponse := &workflowservice.GetWorkflowExecutionHistoryResponse{ @@ -608,7 +608,7 @@ func (s *workflowRunSuite) TestExecuteWorkflow_NoIdInOptions_RawHistory() { } s.workflowServiceClient.EXPECT().StartWorkflowExecution(gomock.Any(), gomock.Any(), gomock.Any()).Return(createResponse, nil).Times(1) - eventType := eventpb.EventType_WorkflowExecutionCompleted + eventType := eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED workflowResult := time.Hour * 59 encodedResult, _ := encodeArg(s.dataConverter, workflowResult) events := []*eventpb.HistoryEvent{ @@ -659,8 +659,8 @@ func (s *workflowRunSuite) TestExecuteWorkflow_NoDup_Cancelled() { } s.workflowServiceClient.EXPECT().StartWorkflowExecution(gomock.Any(), gomock.Any(), gomock.Any()).Return(createResponse, nil).Times(1) - filterType := filterpb.HistoryEventFilterType_CloseEvent - eventType := eventpb.EventType_WorkflowExecutionCanceled + filterType := filterpb.HISTORY_EVENT_FILTER_TYPE_CLOSE_EVENT + eventType := eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_CANCELED details := "some details" encodedDetails, _ := encodeArg(getDefaultDataConverter(), details) getRequest := getGetWorkflowExecutionHistoryRequest(filterType) @@ -709,8 +709,8 @@ func (s *workflowRunSuite) TestExecuteWorkflow_NoDup_Failed() { } s.workflowServiceClient.EXPECT().StartWorkflowExecution(gomock.Any(), gomock.Any(), gomock.Any()).Return(createResponse, nil).Times(1) - filterType := filterpb.HistoryEventFilterType_CloseEvent - eventType := eventpb.EventType_WorkflowExecutionFailed + filterType := filterpb.HISTORY_EVENT_FILTER_TYPE_CLOSE_EVENT + eventType := eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_FAILED reason := "some reason" details := "some details" applicationError := NewApplicationError(reason, false, nil, details) @@ -763,8 +763,8 @@ func (s *workflowRunSuite) TestExecuteWorkflow_NoDup_Terminated() { } s.workflowServiceClient.EXPECT().StartWorkflowExecution(gomock.Any(), gomock.Any(), gomock.Any()).Return(createResponse, nil).Times(1) - filterType := filterpb.HistoryEventFilterType_CloseEvent - eventType := eventpb.EventType_WorkflowExecutionTerminated + filterType := filterpb.HISTORY_EVENT_FILTER_TYPE_CLOSE_EVENT + eventType := eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_TERMINATED getRequest := getGetWorkflowExecutionHistoryRequest(filterType) getResponse := &workflowservice.GetWorkflowExecutionHistoryResponse{ History: &eventpb.History{ @@ -807,8 +807,8 @@ func (s *workflowRunSuite) TestExecuteWorkflow_NoDup_TimedOut() { } s.workflowServiceClient.EXPECT().StartWorkflowExecution(gomock.Any(), gomock.Any(), gomock.Any()).Return(createResponse, nil).Times(1) - filterType := filterpb.HistoryEventFilterType_CloseEvent - eventType := eventpb.EventType_WorkflowExecutionTimedOut + filterType := filterpb.HISTORY_EVENT_FILTER_TYPE_CLOSE_EVENT + eventType := eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_TIMED_OUT getRequest := getGetWorkflowExecutionHistoryRequest(filterType) getResponse := &workflowservice.GetWorkflowExecutionHistoryResponse{ History: &eventpb.History{ @@ -816,7 +816,7 @@ func (s *workflowRunSuite) TestExecuteWorkflow_NoDup_TimedOut() { { EventType: eventType, Attributes: &eventpb.HistoryEvent_WorkflowExecutionTimedOutEventAttributes{WorkflowExecutionTimedOutEventAttributes: &eventpb.WorkflowExecutionTimedOutEventAttributes{ - RetryStatus: commonpb.RetryStatus_Timeout, + RetryStatus: commonpb.RETRY_STATUS_TIMEOUT, }}, }, }, @@ -846,7 +846,7 @@ func (s *workflowRunSuite) TestExecuteWorkflow_NoDup_TimedOut() { s.True(ok) var timeoutErr *TimeoutError s.True(errors.As(err, &timeoutErr)) - s.Equal(commonpb.TimeoutType_StartToClose, timeoutErr.TimeoutType()) + s.Equal(commonpb.TIMEOUT_TYPE_START_TO_CLOSE, timeoutErr.TimeoutType()) s.Equal(time.Minute, decodedResult) } @@ -857,8 +857,8 @@ func (s *workflowRunSuite) TestExecuteWorkflow_NoDup_ContinueAsNew() { s.workflowServiceClient.EXPECT().StartWorkflowExecution(gomock.Any(), gomock.Any(), gomock.Any()).Return(createResponse, nil).Times(1) newRunID := "some other random run ID" - filterType := filterpb.HistoryEventFilterType_CloseEvent - eventType1 := eventpb.EventType_WorkflowExecutionContinuedAsNew + filterType := filterpb.HISTORY_EVENT_FILTER_TYPE_CLOSE_EVENT + eventType1 := eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_CONTINUED_AS_NEW getRequest1 := getGetWorkflowExecutionHistoryRequest(filterType) getResponse1 := &workflowservice.GetWorkflowExecutionHistoryResponse{ History: &eventpb.History{ @@ -877,7 +877,7 @@ func (s *workflowRunSuite) TestExecuteWorkflow_NoDup_ContinueAsNew() { workflowResult := time.Hour * 59 encodedResult, _ := encodeArg(getDefaultDataConverter(), workflowResult) - eventType2 := eventpb.EventType_WorkflowExecutionCompleted + eventType2 := eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED getRequest2 := getGetWorkflowExecutionHistoryRequest(filterType) getRequest2.Execution.RunId = newRunID getResponse2 := &workflowservice.GetWorkflowExecutionHistoryResponse{ @@ -915,8 +915,8 @@ func (s *workflowRunSuite) TestExecuteWorkflow_NoDup_ContinueAsNew() { } func (s *workflowRunSuite) TestGetWorkflow() { - filterType := filterpb.HistoryEventFilterType_CloseEvent - eventType := eventpb.EventType_WorkflowExecutionCompleted + filterType := filterpb.HISTORY_EVENT_FILTER_TYPE_CLOSE_EVENT + eventType := eventpb.EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED workflowResult := time.Hour * 59 encodedResult, _ := encodeArg(getDefaultDataConverter(), workflowResult) getRequest := getGetWorkflowExecutionHistoryRequest(filterType) @@ -1331,10 +1331,10 @@ func (s *workflowClientTestSuite) TestGetSearchAttributes() { } func serializeEvents(events []*eventpb.HistoryEvent) *commonpb.DataBlob { - blob, _ := serializer.SerializeBatchEvents(events, commonpb.EncodingType_Proto3) + blob, _ := serializer.SerializeBatchEvents(events, commonpb.ENCODING_TYPE_PROTO3) return &commonpb.DataBlob{ - EncodingType: commonpb.EncodingType_Proto3, + EncodingType: commonpb.ENCODING_TYPE_PROTO3, Data: blob.Data, } } diff --git a/internal/internal_workflow_testsuite.go b/internal/internal_workflow_testsuite.go index 7560cd514..3cfc2f51d 100644 --- a/internal/internal_workflow_testsuite.go +++ b/internal/internal_workflow_testsuite.go @@ -559,7 +559,7 @@ func (env *testWorkflowEnvironmentImpl) executeActivity( if err != nil { if err == context.DeadlineExceeded { env.logger.Debug(fmt.Sprintf("Activity %v timed out", task.ActivityType.Name)) - return nil, NewTimeoutError(commonpb.TimeoutType_StartToClose, err) + return nil, NewTimeoutError(commonpb.TIMEOUT_TYPE_START_TO_CLOSE, err) } topLine := fmt.Sprintf("activity for %s [panic]:", defaultTestTaskList) st := getStackTraceRaw(topLine, 7, 0) @@ -1356,7 +1356,7 @@ func (env *testWorkflowEnvironmentImpl) handleActivityResult(activityID string, activityHandle.callback(blob, nil) default: if result == context.DeadlineExceeded { - err = NewTimeoutError(commonpb.TimeoutType_StartToClose, context.DeadlineExceeded) + err = NewTimeoutError(commonpb.TIMEOUT_TYPE_START_TO_CLOSE, context.DeadlineExceeded) activityHandle.callback(nil, err) } else { panic(fmt.Sprintf("unsupported respond type %T", result)) diff --git a/internal/internal_workflow_testsuite_test.go b/internal/internal_workflow_testsuite_test.go index 48febd604..0605ef802 100644 --- a/internal/internal_workflow_testsuite_test.go +++ b/internal/internal_workflow_testsuite_test.go @@ -2872,7 +2872,7 @@ func (s *WorkflowTestSuiteUnitTest) Test_ActivityTimeoutWithDetails() { count := 0 timeoutFn := func() error { count++ - return NewTimeoutError(commonpb.TimeoutType_StartToClose, nil, testErrorDetails1) + return NewTimeoutError(commonpb.TIMEOUT_TYPE_START_TO_CLOSE, nil, testErrorDetails1) } timeoutWf := func(ctx Context) error { @@ -2899,7 +2899,7 @@ func (s *WorkflowTestSuiteUnitTest) Test_ActivityTimeoutWithDetails() { s.Error(err) timeoutErr, ok := err.(*TimeoutError) s.True(ok) - s.Equal(commonpb.TimeoutType_StartToClose, timeoutErr.TimeoutType()) + s.Equal(commonpb.TIMEOUT_TYPE_START_TO_CLOSE, timeoutErr.TimeoutType()) s.True(timeoutErr.HasLastHeartbeatDetails()) var details string err = timeoutErr.LastHeartbeatDetails(&details) @@ -2914,7 +2914,7 @@ func (s *WorkflowTestSuiteUnitTest) Test_ActivityTimeoutWithDetails() { s.Error(err) timeoutErr, ok = err.(*TimeoutError) s.True(ok) - s.Equal(commonpb.TimeoutType_StartToClose, timeoutErr.TimeoutType()) + s.Equal(commonpb.TIMEOUT_TYPE_START_TO_CLOSE, timeoutErr.TimeoutType()) s.True(timeoutErr.HasLastHeartbeatDetails()) err = timeoutErr.LastHeartbeatDetails(&details) s.NoError(err) @@ -2945,7 +2945,7 @@ func (s *WorkflowTestSuiteUnitTest) Test_ActivityDeadlineExceeded() { s.Error(err) timeoutErr, ok := err.(*TimeoutError) s.True(ok) - s.Equal(commonpb.TimeoutType_StartToClose, timeoutErr.TimeoutType()) + s.Equal(commonpb.TIMEOUT_TYPE_START_TO_CLOSE, timeoutErr.TimeoutType()) s.Equal("context deadline exceeded", timeoutErr.cause.Error()) } diff --git a/internal/workflow_testsuite.go b/internal/workflow_testsuite.go index c1fc442cf..cb0ecdca5 100644 --- a/internal/workflow_testsuite.go +++ b/internal/workflow_testsuite.go @@ -310,7 +310,7 @@ func (e *TestWorkflowEnvironment) OnActivity(activity interface{}, args ...inter // ErrMockStartChildWorkflowFailed is special error used to indicate the mocked child workflow should fail to start. // This error is also exposed as public as testsuite.ErrMockStartChildWorkflowFailed -var ErrMockStartChildWorkflowFailed = fmt.Errorf("start child workflow failed: %v", eventpb.StartChildWorkflowExecutionFailedCause_WorkflowAlreadyExists) +var ErrMockStartChildWorkflowFailed = fmt.Errorf("start child workflow failed: %v", eventpb.START_CHILD_WORKFLOW_EXECUTION_FAILED_CAUSE_WORKFLOW_ALREADY_EXISTS) // OnWorkflow setup a mock call for workflow. Parameter workflow must be workflow function (func) or workflow name (string). // You must call Return() with appropriate parameters on the returned *MockCallWrapper instance. The supplied parameters to diff --git a/mocks/mock_test.go b/mocks/mock_test.go index da80ff110..1d0d5f6a7 100644 --- a/mocks/mock_test.go +++ b/mocks/mock_test.go @@ -94,7 +94,7 @@ func Test_MockClient(t *testing.T) { mockHistoryIter.On("Next").Return(&eventpb.HistoryEvent{}, nil).Once() mockClient.On("GetWorkflowHistory", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything). Return(mockHistoryIter).Once() - historyIter := mockClient.GetWorkflowHistory(context.Background(), testWorkflowID, testRunID, true, filterpb.HistoryEventFilterType_CloseEvent) + historyIter := mockClient.GetWorkflowHistory(context.Background(), testWorkflowID, testRunID, true, filterpb.HISTORY_EVENT_FILTER_TYPE_CLOSE_EVENT) mockClient.AssertExpectations(t) require.NotNil(t, historyIter) require.Equal(t, true, historyIter.HasNext()) diff --git a/test/bindings_test.go b/test/bindings_test.go index b5028722e..339710130 100644 --- a/test/bindings_test.go +++ b/test/bindings_test.go @@ -124,7 +124,7 @@ func (ts *AsyncBindingsTestSuite) executeWorkflowWithOption( } err = run.Get(ctx, retValPtr) if ts.config.Debug { - iter := ts.client.GetWorkflowHistory(ctx, options.ID, run.GetRunID(), false, filterpb.HistoryEventFilterType_AllEvent) + iter := ts.client.GetWorkflowHistory(ctx, options.ID, run.GetRunID(), false, filterpb.HISTORY_EVENT_FILTER_TYPE_ALL_EVENT) for iter.HasNext() { event, err1 := iter.Next() if err1 != nil { diff --git a/test/integration_test.go b/test/integration_test.go index cb2b364ec..4e9b9f1ee 100644 --- a/test/integration_test.go +++ b/test/integration_test.go @@ -175,7 +175,7 @@ func (ts *IntegrationTestSuite) TestActivityRetryOnStartToCloseTimeout() { "test-activity-retry-on-start2close-timeout", ts.workflows.ActivityRetryOnTimeout, &expected, - commonpb.TimeoutType_StartToClose) + commonpb.TIMEOUT_TYPE_START_TO_CLOSE) ts.NoError(err) ts.EqualValues(expected, ts.activities.invoked()) @@ -259,7 +259,7 @@ func (ts *IntegrationTestSuite) TestConsistentQuery() { WorkflowID: "test-consistent-query", RunID: run.GetRunID(), QueryType: "consistent_query", - QueryConsistencyLevel: querypb.QueryConsistencyLevel_Strong, + QueryConsistencyLevel: querypb.QUERY_CONSISTENCY_LEVEL_STRONG, }) ts.Nil(err) ts.NotNil(value) @@ -368,7 +368,7 @@ func (ts *IntegrationTestSuite) TestChildWFWithParentClosePolicyTerminate() { ts.NoError(err) info := resp.WorkflowExecutionInfo if info.GetCloseTime().GetValue() > 0 { - ts.Equal(executionpb.WorkflowExecutionStatus_Terminated, info.GetStatus(), info) + ts.Equal(executionpb.WORKFLOW_EXECUTION_STATUS_TERMINATED, info.GetStatus(), info) break } time.Sleep(time.Millisecond * 500) @@ -385,7 +385,7 @@ func (ts *IntegrationTestSuite) TestChildWFWithParentClosePolicyAbandon() { ts.NoError(err) info := resp.WorkflowExecutionInfo if info.GetCloseTime().GetValue() > 0 { - ts.Equal(executionpb.WorkflowExecutionStatus_Completed, info.GetStatus(), info) + ts.Equal(executionpb.WORKFLOW_EXECUTION_STATUS_COMPLETED, info.GetStatus(), info) break } time.Sleep(time.Millisecond * 500) @@ -481,7 +481,7 @@ func (ts *IntegrationTestSuite) executeWorkflowWithOption( } err = run.Get(ctx, retValPtr) if ts.config.Debug { - iter := ts.client.GetWorkflowHistory(ctx, options.ID, run.GetRunID(), false, filterpb.HistoryEventFilterType_AllEvent) + iter := ts.client.GetWorkflowHistory(ctx, options.ID, run.GetRunID(), false, filterpb.HISTORY_EVENT_FILTER_TYPE_ALL_EVENT) for iter.HasNext() { event, err1 := iter.Next() if err1 != nil { diff --git a/test/workflow_test.go b/test/workflow_test.go index 03b7aec8d..cb04c8872 100644 --- a/test/workflow_test.go +++ b/test/workflow_test.go @@ -106,9 +106,9 @@ func (w *Workflows) ActivityRetryOptionsChange(ctx workflow.Context) ([]string, func (w *Workflows) ActivityRetryOnTimeout(ctx workflow.Context, timeoutType commonpb.TimeoutType) ([]string, error) { opts := w.defaultActivityOptionsWithRetry() switch timeoutType { - case commonpb.TimeoutType_ScheduleToClose: + case commonpb.TIMEOUT_TYPE_SCHEDULE_TO_CLOSE: opts.ScheduleToCloseTimeout = time.Second - case commonpb.TimeoutType_StartToClose: + case commonpb.TIMEOUT_TYPE_START_TO_CLOSE: opts.StartToCloseTimeout = time.Second } @@ -161,7 +161,7 @@ func (w *Workflows) ActivityRetryOnHBTimeout(ctx workflow.Context) ([]string, er return nil, fmt.Errorf("activity failed with unexpected error: %v", err) } - if timeoutErr.TimeoutType() != commonpb.TimeoutType_Heartbeat { + if timeoutErr.TimeoutType() != commonpb.TIMEOUT_TYPE_HEARTBEAT { return nil, fmt.Errorf("activity failed due to unexpected timeout %v", timeoutErr.TimeoutType()) } @@ -458,7 +458,7 @@ func (w *Workflows) RetryTimeoutStableErrorWorkflow(ctx workflow.Context) ([]str return []string{}, fmt.Errorf("activity failed with unexpected error: %v", err) } - if timeoutErr.TimeoutType() != commonpb.TimeoutType_ScheduleToClose { + if timeoutErr.TimeoutType() != commonpb.TIMEOUT_TYPE_SCHEDULE_TO_CLOSE { return []string{}, fmt.Errorf("activity timed out with unexpected timeout type: %v", timeoutErr.TimeoutType()) } @@ -468,7 +468,7 @@ func (w *Workflows) RetryTimeoutStableErrorWorkflow(ctx workflow.Context) ([]str return []string{}, fmt.Errorf("activity timed out with unexpected last error %v", err) } - if previousTimeoutErr.TimeoutType() != commonpb.TimeoutType_StartToClose { + if previousTimeoutErr.TimeoutType() != commonpb.TIMEOUT_TYPE_START_TO_CLOSE { return []string{}, fmt.Errorf("activity timed out with unexpected timeout type of last timeout: %v", previousTimeoutErr.TimeoutType()) }