Skip to content

Commit

Permalink
add configuration check to enable standby timer processor (cadence-wo…
Browse files Browse the repository at this point in the history
  • Loading branch information
wxing1292 authored Apr 16, 2018
1 parent 902840b commit be357d4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 66 deletions.
16 changes: 1 addition & 15 deletions service/history/historyEngine2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func (s *engine2Suite) SetupTest() {
// this is used by shard context, not relevant to this test, so we do not care how many times "GetCurrentClusterName" os called
s.mockClusterMetadata.On("GetCurrentClusterName").Return(cluster.TestCurrentClusterName)
s.mockClusterMetadata.On("GetAllClusterFailoverVersions").Return(cluster.TestAllClusterFailoverVersions)
s.mockClusterMetadata.On("IsGlobalDomainEnabled").Return(false)
h := &historyEngineImpl{
currentclusterName: mockShard.GetService().GetClusterMetadata().GetCurrentClusterName(),
shard: mockShard,
Expand Down Expand Up @@ -303,15 +304,13 @@ func (s *engine2Suite) TestRecordDecisionTaskStartedConflictOnUpdate() {
s.mockExecutionMgr.On("GetWorkflowExecution", mock.Anything).Return(gwmsResponse, nil).Once()
s.mockHistoryMgr.On("AppendHistoryEvents", mock.Anything).Return(nil).Once()
s.mockExecutionMgr.On("UpdateWorkflowExecution", mock.Anything).Return(&persistence.ConditionFailedError{}).Once()
s.mockClusterMetadata.On("IsGlobalDomainEnabled").Return(false).Once()

ms2 := createMutableState(msBuilder)
gwmsResponse2 := &persistence.GetWorkflowExecutionResponse{State: ms2}

s.mockExecutionMgr.On("GetWorkflowExecution", mock.Anything).Return(gwmsResponse2, nil).Once()
s.mockHistoryMgr.On("AppendHistoryEvents", mock.Anything).Return(nil).Once()
s.mockExecutionMgr.On("UpdateWorkflowExecution", mock.Anything).Return(nil).Once()
s.mockClusterMetadata.On("IsGlobalDomainEnabled").Return(false).Once()

response, err := s.historyEngine.RecordDecisionTaskStarted(&h.RecordDecisionTaskStartedRequest{
DomainUUID: common.StringPtr("domainId"),
Expand Down Expand Up @@ -350,7 +349,6 @@ func (s *engine2Suite) TestRecordDecisionTaskRetrySameRequest() {
s.mockExecutionMgr.On("GetWorkflowExecution", mock.Anything).Return(gwmsResponse, nil).Once()
s.mockHistoryMgr.On("AppendHistoryEvents", mock.Anything).Return(nil).Once()
s.mockExecutionMgr.On("UpdateWorkflowExecution", mock.Anything).Return(&persistence.ConditionFailedError{}).Once()
s.mockClusterMetadata.On("IsGlobalDomainEnabled").Return(false).Once()

startedEventID := addDecisionTaskStartedEventWithRequestID(msBuilder, int64(2), requestID, tl, identity)
ms2 := createMutableState(msBuilder)
Expand Down Expand Up @@ -394,7 +392,6 @@ func (s *engine2Suite) TestRecordDecisionTaskRetryDifferentRequest() {
s.mockExecutionMgr.On("GetWorkflowExecution", mock.Anything).Return(gwmsResponse, nil).Once()
s.mockHistoryMgr.On("AppendHistoryEvents", mock.Anything).Return(nil).Once()
s.mockExecutionMgr.On("UpdateWorkflowExecution", mock.Anything).Return(&persistence.ConditionFailedError{}).Once()
s.mockClusterMetadata.On("IsGlobalDomainEnabled").Return(false).Once()

// Add event.
addDecisionTaskStartedEventWithRequestID(msBuilder, int64(2), "some_other_req", tl, identity)
Expand Down Expand Up @@ -443,7 +440,6 @@ func (s *engine2Suite) TestRecordDecisionTaskStartedMaxAttemptsExceeded() {
conditionalRetryCount)
s.mockExecutionMgr.On("UpdateWorkflowExecution", mock.Anything).Return(
&persistence.ConditionFailedError{}).Times(conditionalRetryCount)
s.mockClusterMetadata.On("IsGlobalDomainEnabled").Return(false).Times(conditionalRetryCount)

response, err := s.historyEngine.RecordDecisionTaskStarted(&h.RecordDecisionTaskStartedRequest{
DomainUUID: common.StringPtr("domainId"),
Expand Down Expand Up @@ -479,7 +475,6 @@ func (s *engine2Suite) TestRecordDecisionTaskSuccess() {
s.mockExecutionMgr.On("GetWorkflowExecution", mock.Anything).Return(gwmsResponse, nil).Once()
s.mockHistoryMgr.On("AppendHistoryEvents", mock.Anything).Return(nil).Once()
s.mockExecutionMgr.On("UpdateWorkflowExecution", mock.Anything).Return(nil).Once()
s.mockClusterMetadata.On("IsGlobalDomainEnabled").Return(false).Once()

response, err := s.historyEngine.RecordDecisionTaskStarted(&h.RecordDecisionTaskStartedRequest{
DomainUUID: common.StringPtr("domainId"),
Expand Down Expand Up @@ -558,7 +553,6 @@ func (s *engine2Suite) TestRecordActivityTaskStartedSuccess() {
s.mockExecutionMgr.On("GetWorkflowExecution", mock.Anything).Return(gwmsResponse1, nil).Once()
s.mockHistoryMgr.On("AppendHistoryEvents", mock.Anything).Return(nil).Once()
s.mockExecutionMgr.On("UpdateWorkflowExecution", mock.Anything).Return(nil).Once()
s.mockClusterMetadata.On("IsGlobalDomainEnabled").Return(false).Once()

response, err := s.historyEngine.RecordActivityTaskStarted(&h.RecordActivityTaskStartedRequest{
DomainUUID: common.StringPtr("domainId"),
Expand Down Expand Up @@ -597,7 +591,6 @@ func (s *engine2Suite) TestRequestCancelWorkflowExecutionSuccess() {
s.mockExecutionMgr.On("GetWorkflowExecution", mock.Anything).Return(gwmsResponse1, nil).Once()
s.mockHistoryMgr.On("AppendHistoryEvents", mock.Anything).Return(nil).Once()
s.mockExecutionMgr.On("UpdateWorkflowExecution", mock.Anything).Return(nil).Once()
s.mockClusterMetadata.On("IsGlobalDomainEnabled").Return(false).Once()

err := s.historyEngine.RequestCancelWorkflowExecution(&h.RequestCancelWorkflowExecutionRequest{
DomainUUID: common.StringPtr(domainID),
Expand Down Expand Up @@ -703,7 +696,6 @@ func (s *engine2Suite) TestRespondDecisionTaskCompletedRecordMarkerDecision() {
s.mockExecutionMgr.On("GetWorkflowExecution", mock.Anything).Return(gwmsResponse, nil).Once()
s.mockHistoryMgr.On("AppendHistoryEvents", mock.Anything).Return(nil).Once()
s.mockExecutionMgr.On("UpdateWorkflowExecution", mock.Anything).Return(nil).Once()
s.mockClusterMetadata.On("IsGlobalDomainEnabled").Return(false).Once()

err := s.historyEngine.RespondDecisionTaskCompleted(context.Background(), &h.RespondDecisionTaskCompletedRequest{
DomainUUID: common.StringPtr(domainID),
Expand Down Expand Up @@ -731,7 +723,6 @@ func (s *engine2Suite) TestStartWorkflowExecution_BrandNew() {

s.mockHistoryMgr.On("AppendHistoryEvents", mock.Anything).Return(nil).Once()
s.mockExecutionMgr.On("CreateWorkflowExecution", mock.Anything).Return(&persistence.CreateWorkflowExecutionResponse{TaskID: uuid.New()}, nil).Once()
s.mockClusterMetadata.On("IsGlobalDomainEnabled").Return(false).Once()

resp, err := s.historyEngine.StartWorkflowExecution(&h.StartWorkflowExecutionRequest{
DomainUUID: common.StringPtr(domainID),
Expand Down Expand Up @@ -769,7 +760,6 @@ func (s *engine2Suite) TestStartWorkflowExecution_StillRunning_Dedup() {
}).Once()
s.mockHistoryMgr.On("DeleteWorkflowExecutionHistory", mock.Anything).Return(nil).Once()

s.mockClusterMetadata.On("IsGlobalDomainEnabled").Return(false).Once()
resp, err := s.historyEngine.StartWorkflowExecution(&h.StartWorkflowExecutionRequest{
DomainUUID: common.StringPtr(domainID),
StartRequest: &workflow.StartWorkflowExecutionRequest{
Expand Down Expand Up @@ -806,7 +796,6 @@ func (s *engine2Suite) TestStartWorkflowExecution_StillRunning_NonDeDup() {
}).Once()
s.mockHistoryMgr.On("DeleteWorkflowExecutionHistory", mock.Anything).Return(nil).Once()

s.mockClusterMetadata.On("IsGlobalDomainEnabled").Return(false).Once()
resp, err := s.historyEngine.StartWorkflowExecution(&h.StartWorkflowExecutionRequest{
DomainUUID: common.StringPtr(domainID),
StartRequest: &workflow.StartWorkflowExecutionRequest{
Expand Down Expand Up @@ -865,7 +854,6 @@ func (s *engine2Suite) TestStartWorkflowExecution_NotRunning_PrevSuccess() {
s.mockHistoryMgr.On("DeleteWorkflowExecutionHistory", mock.Anything).Return(nil).Once()
}

s.mockClusterMetadata.On("IsGlobalDomainEnabled").Return(false).Once()
resp, err := s.historyEngine.StartWorkflowExecution(&h.StartWorkflowExecutionRequest{
DomainUUID: common.StringPtr(domainID),
StartRequest: &workflow.StartWorkflowExecutionRequest{
Expand Down Expand Up @@ -942,7 +930,6 @@ func (s *engine2Suite) TestStartWorkflowExecution_NotRunning_PrevFail() {
s.mockHistoryMgr.On("DeleteWorkflowExecutionHistory", mock.Anything).Return(nil).Once()
}

s.mockClusterMetadata.On("IsGlobalDomainEnabled").Return(false).Once()
resp, err := s.historyEngine.StartWorkflowExecution(&h.StartWorkflowExecutionRequest{
DomainUUID: common.StringPtr(domainID),
StartRequest: &workflow.StartWorkflowExecutionRequest{
Expand Down Expand Up @@ -1002,7 +989,6 @@ func (s *engine2Suite) TestSignalWithStartWorkflowExecution_JustSignal() {
s.mockExecutionMgr.On("GetWorkflowExecution", mock.Anything).Return(gwmsResponse, nil).Once()
s.mockHistoryMgr.On("AppendHistoryEvents", mock.Anything).Return(nil).Once()
s.mockExecutionMgr.On("UpdateWorkflowExecution", mock.Anything).Return(nil).Once()
s.mockClusterMetadata.On("IsGlobalDomainEnabled").Return(false).Once()

resp, err := s.historyEngine.SignalWithStartWorkflowExecution(sRequest)
s.Nil(err)
Expand Down
Loading

0 comments on commit be357d4

Please sign in to comment.