Skip to content

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
bowenxia committed Sep 11, 2024
1 parent 0dcbc0c commit 78284c9
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions service/frontend/api/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import (
const (
numHistoryShards = 10
testDomain = "test-domain"
canaryDomain = "cadence-canary"
testDomainID = "e4f90ec0-1313-45be-9877-8aa41f72a45a"
testWorkflowID = "test-workflow-id"
testRunID = "2c8b555f-1f55-4955-9d1c-b980194555c9"
Expand Down Expand Up @@ -596,6 +597,39 @@ func (s *workflowHandlerSuite) TestStartWorkflowExecution_IsolationGroupDrained(
s.IsType(err, &types.BadRequestError{})
}

func (s *workflowHandlerSuite) TestStartWorkflowExecution_LogJitterTime() {
config := s.newConfig(dc.NewInMemoryClient())
config.UserRPS = dc.GetIntPropertyFn(10)
wh := s.getWorkflowHandler(config)
jitterStart := int32(10)

startWorkflowExecutionRequest := &types.StartWorkflowExecutionRequest{
Domain: canaryDomain,
WorkflowID: "workflow-id",
WorkflowType: &types.WorkflowType{
Name: "workflow-type",
},
TaskList: &types.TaskList{
Name: "task-list",
},
JitterStartSeconds: &jitterStart,
ExecutionStartToCloseTimeoutSeconds: common.Int32Ptr(1),
TaskStartToCloseTimeoutSeconds: common.Int32Ptr(1),
RetryPolicy: &types.RetryPolicy{
InitialIntervalInSeconds: 1,
BackoffCoefficient: 2,
MaximumIntervalInSeconds: 2,
MaximumAttempts: 1,
ExpirationIntervalInSeconds: 1,
},
RequestID: uuid.New(),
}
s.mockDomainCache.EXPECT().GetDomainID(canaryDomain).Return(s.testDomainID, nil).Times(2)
s.mockHistoryClient.EXPECT().StartWorkflowExecution(gomock.Any(), gomock.Any()).Return(&types.StartWorkflowExecutionResponse{RunID: "test-rid"}, nil)
_, err := wh.StartWorkflowExecution(context.Background(), startWorkflowExecutionRequest)
s.NoError(err)
}

func (s *workflowHandlerSuite) TestDiagnoseWorkflowExecution_Success() {
wh := s.getWorkflowHandler(s.newConfig(dc.NewInMemoryClient()))

Expand Down

0 comments on commit 78284c9

Please sign in to comment.