Add async timeouts to correctly wait session cleanup in test (#176488)

## Summary

Closes #164186  

This PR addresses the potential issue of a sessions not being cleaned up
by introducing a timeout before attempting to clean each one. Passing
these [changes through
FTR](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5093)
make it pass 100% of the time with 97 test runs.
This commit is contained in:
Sid 2024-03-07 10:46:35 +01:00 committed by GitHub
parent 1bffdd6528
commit af5f4a0558
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -404,8 +404,11 @@ export default function ({ getService }: FtrProviderContext) {
log.debug(`Starting SAML handshake 3 times.`);
const unauthenticatedSessionOne = await startSAMLHandshake();
await setTimeoutAsync(500);
const unauthenticatedSessionTwo = await startSAMLHandshake();
await setTimeoutAsync(500);
const unauthenticatedSessionThree = await startSAMLHandshake();
await setTimeoutAsync(500);
log.debug('Waiting for all sessions to be persisted...');
await retry.tryForTime(20000, async () => {