Skip to content

Commit

Permalink
[8.x] Flaky #111821 - Refresh index (#199136) (#199172)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.x`:
- [Flaky #111821 - Refresh index
(#199136)](#199136)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Alejandro Fernández
Haro","email":"alejandro.haro@elastic.co"},"sourceCommit":{"committedDate":"2024-11-06T16:10:06Z","message":"Flaky
#111821 - Refresh index
(#199136)","sha":"8054aa253fddc5be6c88904024518d30f5d8ae1d","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","v9.0.0","backport:prev-minor"],"title":"Flaky
#111821 - Refresh
index","number":199136,"url":"https://github.com/elastic/kibana/pull/199136","mergeCommit":{"message":"Flaky
#111821 - Refresh index
(#199136)","sha":"8054aa253fddc5be6c88904024518d30f5d8ae1d"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/199136","number":199136,"mergeCommit":{"message":"Flaky
#111821 - Refresh index
(#199136)","sha":"8054aa253fddc5be6c88904024518d30f5d8ae1d"}}]}]
BACKPORT-->

Co-authored-by: Alejandro Fernández Haro <alejandro.haro@elastic.co>
  • Loading branch information
kibanamachine and afharo authored Nov 6, 2024
1 parent d040cc4 commit bd38553
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@
*/

import moment, { type MomentInput } from 'moment';
import type { Logger, ISavedObjectsRepository, SavedObject } from '@kbn/core/server';
import type {
Logger,
ISavedObjectsRepository,
SavedObject,
ElasticsearchClient,
} from '@kbn/core/server';
import {
type TestElasticsearchUtils,
type TestKibanaUtils,
Expand Down Expand Up @@ -72,11 +77,11 @@ function createRawEventLoopDelaysDailyDocs() {
return { rawEventLoopDelaysDaily, outdatedRawEventLoopDelaysDaily };
}

// Failing: See https://github.com/elastic/kibana/issues/111821
describe.skip(`daily rollups integration test`, () => {
describe(`daily rollups integration test`, () => {
let esServer: TestElasticsearchUtils;
let root: TestKibanaUtils['root'];
let internalRepository: ISavedObjectsRepository;
let esClient: ElasticsearchClient;
let logger: Logger;
let rawEventLoopDelaysDaily: Array<SavedObject<EventLoopDelaysDaily>>;
let outdatedRawEventLoopDelaysDaily: Array<SavedObject<EventLoopDelaysDaily>>;
Expand All @@ -94,6 +99,7 @@ describe.skip(`daily rollups integration test`, () => {
const start = await root.start();
logger = root.logger.get('test daily rollups');
internalRepository = start.savedObjects.createInternalRepository([SAVED_OBJECTS_DAILY_TYPE]);
esClient = start.elasticsearch.client.asInternalUser;

// Create the docs now
const rawDailyDocs = createRawEventLoopDelaysDailyDocs();
Expand All @@ -113,6 +119,7 @@ describe.skip(`daily rollups integration test`, () => {

it('deletes documents older that 3 days from the saved objects repository', async () => {
await rollDailyData(logger, internalRepository);
await esClient.indices.refresh({ index: `.kibana` }); // Make sure that the changes are searchable
const { total, saved_objects: savedObjects } =
await internalRepository.find<EventLoopDelaysDaily>({ type: SAVED_OBJECTS_DAILY_TYPE });
expect(total).toBe(rawEventLoopDelaysDaily.length);
Expand Down

0 comments on commit bd38553

Please sign in to comment.