Skip to content

Commit cf45c39

Browse files
authored
Fix flaky migrations tests (#111365)
1 parent 285d232 commit cf45c39

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/core/server/saved_objects/migrationsv2/integration_tests/batch_size_bytes.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ describe('migration v2', () => {
6767
await root.setup();
6868
await expect(root.start()).resolves.toBeTruthy();
6969

70-
await new Promise((resolve) => setTimeout(resolve, 1000));
70+
// After plugins start, some saved objects are deleted/recreated, so we
71+
// wait a bit for the count to settle.
72+
await new Promise((resolve) => setTimeout(resolve, 5000));
7173

7274
const esClient: ElasticsearchClient = esServer.es.getClient();
7375
const migratedIndexResponse = await esClient.count({

src/core/server/saved_objects/migrationsv2/test_helpers/retry.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88

99
import { retryAsync } from './retry_async';
1010

11-
// FLAKY: https://github.com/elastic/kibana/issues/110970
12-
describe.skip('retry', () => {
11+
describe('retry', () => {
1312
it('retries throwing functions until they succeed', async () => {
1413
let i = 0;
1514
await expect(
@@ -53,6 +52,8 @@ describe.skip('retry', () => {
5352
},
5453
{ retryAttempts: 3, retryDelayMs: 100 }
5554
);
56-
expect(Date.now() - now).toBeGreaterThanOrEqual(200);
55+
// Would expect it to take 200ms but seems like timing inaccuracies
56+
// sometimes causes the duration to be measured as 199ms
57+
expect(Date.now() - now).toBeGreaterThanOrEqual(199);
5758
});
5859
});

0 commit comments

Comments
 (0)