[Fleet] Make failing secrets test more robust (#164740)

## Summary

Closes #163901

Instead of one sleep lets try 3 times.
This commit is contained in:
Mark Hopkin 2023-08-24 17:37:53 +01:00 committed by GitHub
parent 30872c4bab
commit 67958a1660
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -598,12 +598,16 @@ export default function (providerContext: FtrProviderContext) {
.set('kbn-xsrf', 'xxxx')
.expect(200);
// sleep to allow for secrets to be deleted
await new Promise((resolve) => setTimeout(resolve, 1000));
for (let i = 0; i < 3; i++) {
await new Promise((resolve) => setTimeout(resolve, 1000));
const searchRes = await getSecrets();
const searchRes = await getSecrets();
if (searchRes.hits.hits.length === 0) {
return;
}
}
expect(searchRes.hits.hits.length).to.eql(0);
throw new Error('Secrets not deleted');
});
it('should not store secrets if fleet server does not meet minimum version', async () => {