[Backport 2.x] change Thread.sleep to waitUntil function under test files (#1242)
Issue #, if available: #1028 Description of changes:
CheckList:
- [ ] Commits are signed per the DCO using --signoff
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.
Test failure on Multi-node Test Workflow / Build and test Alerting is not related to my changes and exactly same test failures are prevalent on other 2.x PRs. (https://github.com/opensearch-project/alerting/actions/runs/6753232443/job/18359489384?pr=1272 (line 279) https://github.com/opensearch-project/alerting/actions/runs/6422330525/job/17438601216?pr=1230 (line 320) https://github.com/opensearch-project/alerting/actions/runs/6193002391/job/16813867144?pr=1168 (line 310))