Skip to content

Commit

Permalink
removing time.Sleep from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Shivs11 committed Jan 8, 2025
1 parent 9bf96e3 commit 114a87d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/versioning_3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,15 +301,19 @@ func (s *Versioning3Suite) testUnpinnedQuery(sticky bool) {
s.verifyWorkflowStickyQueue(we, tv.StickyTaskQueue())
}

go s.idlePollWorkflow(tvB, true, ver3MinPollTime, "new deployment should not receive query")
pollerDone := make(chan interface{})
go func() {
s.idlePollWorkflow(tvB, true, ver3MinPollTime, "new deployment should not receive query")
close(pollerDone)
}()
s.pollAndQueryWorkflow(tv, sticky)
time.Sleep(ver3MinPollTime) // //nolint:forbidigo
<-pollerDone // wait for the idle poller to complete to not interfere with the next poller

// redirect query to new deployment
s.updateTaskQueueDeploymentData(tvB, 0, tqTypeWf, tqTypeAct)

go s.idlePollWorkflow(tv, true, ver3MinPollTime, "old deployment should not receive query")
// Since the current deployment has changed, task moves to the normal queue
// Since the current deployment has changed, task will move to the normal queue (thus, sticky=false)
s.pollAndQueryWorkflow(tvB, false)

}
Expand Down

0 comments on commit 114a87d

Please sign in to comment.