From 114a87d55bc65c354ee5aa005e1aede6e0b6b7e3 Mon Sep 17 00:00:00 2001 From: Shivam Saraf Date: Wed, 8 Jan 2025 10:08:50 -0500 Subject: [PATCH] removing time.Sleep from tests --- tests/versioning_3_test.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/versioning_3_test.go b/tests/versioning_3_test.go index a7d172721cf..8b3a237942c 100644 --- a/tests/versioning_3_test.go +++ b/tests/versioning_3_test.go @@ -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) }