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

# Backport

This will backport the following commits from `main` to `8.10`:
- [[Fleet] Make failing secrets test more robust
(#164740)](https://github.com/elastic/kibana/pull/164740)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Mark
Hopkin","email":"mark.hopkin@elastic.co"},"sourceCommit":{"committedDate":"2023-08-24T16:37:53Z","message":"[Fleet]
Make failing secrets test more robust (#164740)\n\n##
Summary\r\n\r\nCloses #163901\r\n\r\nInstead of one sleep lets try 3
times.","sha":"67958a1660c5504488cbe02360619bfd13de34b1","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","backport:prev-minor","v8.11.0"],"number":164740,"url":"https://github.com/elastic/kibana/pull/164740","mergeCommit":{"message":"[Fleet]
Make failing secrets test more robust (#164740)\n\n##
Summary\r\n\r\nCloses #163901\r\n\r\nInstead of one sleep lets try 3
times.","sha":"67958a1660c5504488cbe02360619bfd13de34b1"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/164740","number":164740,"mergeCommit":{"message":"[Fleet]
Make failing secrets test more robust (#164740)\n\n##
Summary\r\n\r\nCloses #163901\r\n\r\nInstead of one sleep lets try 3
times.","sha":"67958a1660c5504488cbe02360619bfd13de34b1"}}]}]
BACKPORT-->

Co-authored-by: Mark Hopkin <mark.hopkin@elastic.co>
This commit is contained in:
Kibana Machine 2023-08-24 13:46:43 -04:00 committed by GitHub
parent 4cb789e58b
commit c37d5bc9e2
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 () => {