Skip to content

Commit

Permalink
Fix flaky test for visibility (#977)
Browse files Browse the repository at this point in the history
* Fix flaky test for visibility

* Small adjust
  • Loading branch information
vancexu authored Jul 18, 2018
1 parent 3a79fc0 commit 17023c7
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions host/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3504,7 +3504,6 @@ func (s *integrationSuite) TestVisibility() {
closedCount = len(resp.Executions)
s.Equal(1, closedCount)

ListOpenLoop:
for i := 0; i < 10; i++ {
resp, err4 := s.engine.ListOpenWorkflowExecutions(createContext(), &workflow.ListOpenWorkflowExecutionsRequest{
Domain: common.StringPtr(s.domainName),
Expand All @@ -3513,12 +3512,11 @@ ListOpenLoop:
})
s.Nil(err4)
openCount = len(resp.Executions)
if openCount == 0 {
s.logger.Info("Open WorkflowExecution is not yet visibile")
time.Sleep(100 * time.Millisecond)
continue ListOpenLoop
if openCount == 1 {
break
}
break ListOpenLoop
s.logger.Info("Open WorkflowExecution is not yet visible")
time.Sleep(100 * time.Millisecond)
}
s.Equal(1, openCount)
}
Expand Down Expand Up @@ -6171,8 +6169,14 @@ func (s *integrationSuite) TestSignalWithStartWorkflow() {
})
s.Nil(err)

listResp, err = s.engine.ListOpenWorkflowExecutions(createContext(), listOpenRequest)
s.NoError(err)
for i := 0; i < 10; i++ { // retry
listResp, err = s.engine.ListOpenWorkflowExecutions(createContext(), listOpenRequest)
s.NoError(err)
if len(listResp.Executions) == 0 {
break
}
time.Sleep(100 * time.Millisecond)
}
s.Equal(0, len(listResp.Executions))

listClosedRequest := &workflow.ListClosedWorkflowExecutionsRequest{
Expand Down

0 comments on commit 17023c7

Please sign in to comment.