Fix flaky migrations tests (#111365)

This commit is contained in:
Rudolf Meijering 2021-09-07 15:49:51 +02:00 committed by GitHub
parent 285d232601
commit cf45c39e0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View file

@ -67,7 +67,9 @@ describe('migration v2', () => {
await root.setup();
await expect(root.start()).resolves.toBeTruthy();
await new Promise((resolve) => setTimeout(resolve, 1000));
// After plugins start, some saved objects are deleted/recreated, so we
// wait a bit for the count to settle.
await new Promise((resolve) => setTimeout(resolve, 5000));
const esClient: ElasticsearchClient = esServer.es.getClient();
const migratedIndexResponse = await esClient.count({

View file

@ -8,8 +8,7 @@
import { retryAsync } from './retry_async';
// FLAKY: https://github.com/elastic/kibana/issues/110970
describe.skip('retry', () => {
describe('retry', () => {
it('retries throwing functions until they succeed', async () => {
let i = 0;
await expect(
@ -53,6 +52,8 @@ describe.skip('retry', () => {
},
{ retryAttempts: 3, retryDelayMs: 100 }
);
expect(Date.now() - now).toBeGreaterThanOrEqual(200);
// Would expect it to take 200ms but seems like timing inaccuracies
// sometimes causes the duration to be measured as 199ms
expect(Date.now() - now).toBeGreaterThanOrEqual(199);
});
});