diff --git a/test/functional/apps/dashboard/dashboard_filter_bar.js b/test/functional/apps/dashboard/dashboard_filter_bar.js index f9b0d0a370c06..f3241568bbb3e 100644 --- a/test/functional/apps/dashboard/dashboard_filter_bar.js +++ b/test/functional/apps/dashboard/dashboard_filter_bar.js @@ -30,7 +30,8 @@ export default function ({ getService, getPageObjects }) { const browser = getService('browser'); const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'visualize', 'timePicker']); - describe('dashboard filter bar', () => { + // FLAKY: https://github.com/elastic/kibana/issues/71987 + describe.skip('dashboard filter bar', () => { before(async () => { await esArchiver.load('dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ diff --git a/test/functional/apps/visualize/_tsvb_chart.ts b/test/functional/apps/visualize/_tsvb_chart.ts index 191572e3e1354..5e8d2ef5653f2 100644 --- a/test/functional/apps/visualize/_tsvb_chart.ts +++ b/test/functional/apps/visualize/_tsvb_chart.ts @@ -28,7 +28,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const security = getService('security'); const PageObjects = getPageObjects(['visualize', 'visualBuilder', 'timePicker', 'visChart']); - describe('visual builder', function describeIndexTests() { + // FLAKY: https://github.com/elastic/kibana/issues/71979 + describe.skip('visual builder', function describeIndexTests() { this.tags('includeFirefox'); beforeEach(async () => { await security.testUser.setRoles([ diff --git a/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/template/__snapshots__/template.test.ts.snap b/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/template/__snapshots__/template.test.ts.snap index 47817a29b2a17..219c2de675359 100644 --- a/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/template/__snapshots__/template.test.ts.snap +++ b/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/template/__snapshots__/template.test.ts.snap @@ -10,7 +10,7 @@ exports[`tests loading base.yml: base.yml 1`] = ` "settings": { "index": { "lifecycle": { - "name": "logs-default" + "name": "logs" }, "codec": "best_compression", "mapping": { @@ -113,7 +113,7 @@ exports[`tests loading coredns.logs.yml: coredns.logs.yml 1`] = ` "settings": { "index": { "lifecycle": { - "name": "logs-default" + "name": "logs" }, "codec": "best_compression", "mapping": { @@ -216,7 +216,7 @@ exports[`tests loading system.yml: system.yml 1`] = ` "settings": { "index": { "lifecycle": { - "name": "metrics-default" + "name": "metrics" }, "codec": "best_compression", "mapping": { diff --git a/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/template/template.ts b/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/template/template.ts index cb1d692c43844..876573f2270ea 100644 --- a/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/template/template.ts +++ b/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/template/template.ts @@ -262,7 +262,7 @@ function getBaseTemplate( index: { // ILM Policy must be added here, for now point to the default global ILM policy name lifecycle: { - name: `${type}-default`, + name: type, }, // What should be our default for the compression? codec: 'best_compression', diff --git a/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/__snapshots__/mvt_single_layer_source_settings.test.tsx.snap b/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/__snapshots__/mvt_single_layer_source_settings.test.tsx.snap index 699173bd362fa..c82618a500a33 100644 --- a/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/__snapshots__/mvt_single_layer_source_settings.test.tsx.snap +++ b/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/__snapshots__/mvt_single_layer_source_settings.test.tsx.snap @@ -8,7 +8,7 @@ exports[`should not render fields-editor when there is no layername 1`] = ` fullWidth={false} hasChildLabel={true} hasEmptyLabelSpace={false} - label="Tile layer" + label="Source layer" labelType="label" > { label={i18n.translate( 'xpack.maps.source.MVTSingleLayerVectorSourceEditor.layerNameMessage', { - defaultMessage: 'Tile layer', + defaultMessage: 'Source layer', } )} > diff --git a/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/mvt_single_layer_vector_source.test.tsx b/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/mvt_single_layer_vector_source.test.tsx index bc08baad7a842..4e9e1e9cd7680 100644 --- a/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/mvt_single_layer_vector_source.test.tsx +++ b/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/mvt_single_layer_vector_source.test.tsx @@ -84,7 +84,7 @@ describe('getImmutableSourceProperties', () => { const source = new MVTSingleLayerVectorSource(descriptor); const properties = await source.getImmutableProperties(); expect(properties).toEqual([ - { label: 'Data source', value: '.pbf vector tiles' }, + { label: 'Data source', value: 'Vector tiles' }, { label: 'Url', value: 'https://example.com/{x}/{y}/{z}.pbf' }, ]); }); diff --git a/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/mvt_single_layer_vector_source.tsx b/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/mvt_single_layer_vector_source.tsx index 1b37ca31cda35..e64d20138cfb8 100644 --- a/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/mvt_single_layer_vector_source.tsx +++ b/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/mvt_single_layer_vector_source.tsx @@ -32,7 +32,7 @@ import { ITooltipProperty, TooltipProperty } from '../../tooltips/tooltip_proper export const sourceTitle = i18n.translate( 'xpack.maps.source.MVTSingleLayerVectorSource.sourceTitle', { - defaultMessage: '.pbf vector tiles', + defaultMessage: 'Vector tiles', } ); diff --git a/x-pack/plugins/security_solution/public/common/utils/test_utils.ts b/x-pack/plugins/security_solution/public/common/utils/test_utils.ts deleted file mode 100644 index 5a3cddb74657d..0000000000000 --- a/x-pack/plugins/security_solution/public/common/utils/test_utils.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { ReactWrapper } from 'enzyme'; -import { act } from 'react-dom/test-utils'; - -// Temporary fix for https://github.com/enzymejs/enzyme/issues/2073 -export const waitForUpdates = async

(wrapper: ReactWrapper

) => { - await act(async () => { - await new Promise((resolve) => setTimeout(resolve, 0)); - wrapper.update(); - }); -}; diff --git a/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/form.test.tsx b/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/form.test.tsx index ce5d19259e9ee..e2e793b34eaf9 100644 --- a/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/form.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/form.test.tsx @@ -7,7 +7,6 @@ import React, { FormEvent } from 'react'; import { mount, ReactWrapper } from 'enzyme'; import { act } from 'react-dom/test-utils'; -import { waitForUpdates } from '../../../common/utils/test_utils'; import { TestProviders } from '../../../common/mock'; import { ValueListsForm } from './form'; import { useImportList } from '../../../shared_imports'; @@ -30,10 +29,6 @@ const mockSelectFile:

(container: ReactWrapper

, file: File) => Promise { @@ -68,7 +63,6 @@ describe('ValueListsForm', () => { await mockSelectFile(container, mockFile); container.find('button[data-test-subj="value-lists-form-import-action"]').simulate('click'); - await waitForUpdates(container); expect(mockImportList).toHaveBeenCalledWith(expect.objectContaining({ file: mockFile })); }); @@ -80,12 +74,11 @@ describe('ValueListsForm', () => { })); const onError = jest.fn(); - const container = mount( + mount( ); - await waitForUpdates(container); expect(onError).toHaveBeenCalledWith('whoops'); }); @@ -97,12 +90,11 @@ describe('ValueListsForm', () => { })); const onSuccess = jest.fn(); - const container = mount( + mount( ); - await waitForUpdates(container); expect(onSuccess).toHaveBeenCalledWith({ mockResult: true }); }); diff --git a/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/modal.test.tsx b/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/modal.test.tsx index ab2bc9b2e90e1..175882de551cb 100644 --- a/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/modal.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/value_lists_management_modal/modal.test.tsx @@ -9,10 +9,8 @@ import { mount } from 'enzyme'; import { TestProviders } from '../../../common/mock'; import { ValueListsModal } from './modal'; -import { waitForUpdates } from '../../../common/utils/test_utils'; -// TODO: These are occasionally timing out -describe.skip('ValueListsModal', () => { +describe('ValueListsModal', () => { it('renders nothing if showModal is false', () => { const container = mount( @@ -21,20 +19,21 @@ describe.skip('ValueListsModal', () => { ); expect(container.find('EuiModal')).toHaveLength(0); + container.unmount(); }); - it('renders modal if showModal is true', async () => { + it('renders modal if showModal is true', () => { const container = mount( ); - await waitForUpdates(container); expect(container.find('EuiModal')).toHaveLength(1); + container.unmount(); }); - it('calls onClose when modal is closed', async () => { + it('calls onClose when modal is closed', () => { const onClose = jest.fn(); const container = mount( @@ -44,21 +43,19 @@ describe.skip('ValueListsModal', () => { container.find('button[data-test-subj="value-lists-modal-close-action"]').simulate('click'); - await waitForUpdates(container); - expect(onClose).toHaveBeenCalled(); + container.unmount(); }); - it('renders ValueListsForm and ValueListsTable', async () => { + it('renders ValueListsForm and ValueListsTable', () => { const container = mount( ); - await waitForUpdates(container); - expect(container.find('ValueListsForm')).toHaveLength(1); expect(container.find('ValueListsTable')).toHaveLength(1); + container.unmount(); }); }); diff --git a/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx b/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx index f7c77bc2dfdf8..286cc870378e1 100644 --- a/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx +++ b/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx @@ -9,7 +9,6 @@ import React from 'react'; import { MemoryRouter } from 'react-router-dom'; import '../../common/mock/match_media'; -import { waitForUpdates } from '../../common/utils/test_utils'; import { TestProviders } from '../../common/mock'; import { useWithSource } from '../../common/containers/source'; import { @@ -65,7 +64,7 @@ describe('Overview', () => { mockuseMessagesStorage.mockImplementation(() => endpointNoticeMessage(false)); }); - it('renders the Setup Instructions text', async () => { + it('renders the Setup Instructions text', () => { const wrapper = mount( @@ -73,11 +72,10 @@ describe('Overview', () => { ); - await waitForUpdates(wrapper); expect(wrapper.find('[data-test-subj="empty-page"]').exists()).toBe(true); }); - it('does not show Endpoint get ready button when ingest is not enabled', async () => { + it('does not show Endpoint get ready button when ingest is not enabled', () => { const wrapper = mount( @@ -85,11 +83,10 @@ describe('Overview', () => { ); - await waitForUpdates(wrapper); expect(wrapper.find('[data-test-subj="empty-page-secondary-action"]').exists()).toBe(false); }); - it('shows Endpoint get ready button when ingest is enabled', async () => { + it('shows Endpoint get ready button when ingest is enabled', () => { (useIngestEnabledCheck as jest.Mock).mockReturnValue({ allEnabled: true }); const wrapper = mount( @@ -98,12 +95,11 @@ describe('Overview', () => { ); - await waitForUpdates(wrapper); expect(wrapper.find('[data-test-subj="empty-page-secondary-action"]').exists()).toBe(true); }); }); - it('it DOES NOT render the Getting started text when an index is available', async () => { + it('it DOES NOT render the Getting started text when an index is available', () => { (useWithSource as jest.Mock).mockReturnValue({ indicesExist: true, indexPattern: {}, @@ -120,12 +116,12 @@ describe('Overview', () => { ); - await waitForUpdates(wrapper); expect(wrapper.find('[data-test-subj="empty-page"]').exists()).toBe(false); + wrapper.unmount(); }); - test('it DOES render the Endpoint banner when the endpoint index is NOT available AND storage is NOT set', async () => { + test('it DOES render the Endpoint banner when the endpoint index is NOT available AND storage is NOT set', () => { (useWithSource as jest.Mock).mockReturnValueOnce({ indicesExist: true, indexPattern: {}, @@ -147,12 +143,12 @@ describe('Overview', () => { ); - await waitForUpdates(wrapper); expect(wrapper.find('[data-test-subj="endpoint-prompt-banner"]').exists()).toBe(true); + wrapper.unmount(); }); - test('it does NOT render the Endpoint banner when the endpoint index is NOT available but storage is set', async () => { + test('it does NOT render the Endpoint banner when the endpoint index is NOT available but storage is set', () => { (useWithSource as jest.Mock).mockReturnValueOnce({ indicesExist: true, indexPattern: {}, @@ -174,12 +170,12 @@ describe('Overview', () => { ); - await waitForUpdates(wrapper); expect(wrapper.find('[data-test-subj="endpoint-prompt-banner"]').exists()).toBe(false); + wrapper.unmount(); }); - test('it does NOT render the Endpoint banner when the endpoint index is available AND storage is set', async () => { + test('it does NOT render the Endpoint banner when the endpoint index is available AND storage is set', () => { (useWithSource as jest.Mock).mockReturnValue({ indicesExist: true, indexPattern: {}, @@ -196,12 +192,12 @@ describe('Overview', () => { ); - await waitForUpdates(wrapper); expect(wrapper.find('[data-test-subj="endpoint-prompt-banner"]').exists()).toBe(false); + wrapper.unmount(); }); - test('it does NOT render the Endpoint banner when an index IS available but storage is NOT set', async () => { + test('it does NOT render the Endpoint banner when an index IS available but storage is NOT set', () => { (useWithSource as jest.Mock).mockReturnValue({ indicesExist: true, indexPattern: {}, @@ -219,9 +215,10 @@ describe('Overview', () => { ); expect(wrapper.find('[data-test-subj="endpoint-prompt-banner"]').exists()).toBe(false); + wrapper.unmount(); }); - test('it does NOT render the Endpoint banner when Ingest is NOT available', async () => { + test('it does NOT render the Endpoint banner when Ingest is NOT available', () => { (useWithSource as jest.Mock).mockReturnValue({ indicesExist: true, indexPattern: {}, @@ -238,9 +235,9 @@ describe('Overview', () => { ); - await waitForUpdates(wrapper); expect(wrapper.find('[data-test-subj="endpoint-prompt-banner"]').exists()).toBe(false); + wrapper.unmount(); }); }); }); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filter_events_with_list.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filter_events_with_list.ts index 654ace290f85f..ea52aecb379fa 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filter_events_with_list.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filter_events_with_list.ts @@ -32,6 +32,7 @@ export const filterEventsAgainstList = async ({ buildRuleMessage, }: FilterEventsAgainstList): Promise => { try { + logger.debug(buildRuleMessage(`exceptionsList: ${JSON.stringify(exceptionsList, null, 2)}`)); if (exceptionsList == null || exceptionsList.length === 0) { logger.debug(buildRuleMessage('about to return original search result')); return eventSearchResult; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/search_after_bulk_create.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/search_after_bulk_create.ts index cd6beb9c68ab2..2a0e39cbbf237 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/search_after_bulk_create.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/search_after_bulk_create.ts @@ -91,7 +91,7 @@ export const searchAfterAndBulkCreate = async ({ }; let sortId; // tells us where to start our next search_after query - let signalsCreatedCount = 0; + let searchResultSize = 0; /* The purpose of `maxResults` is to ensure we do not perform @@ -127,8 +127,8 @@ export const searchAfterAndBulkCreate = async ({ toReturn.success = false; return toReturn; } - signalsCreatedCount = 0; - while (signalsCreatedCount < tuple.maxSignals) { + searchResultSize = 0; + while (searchResultSize < tuple.maxSignals) { try { logger.debug(buildRuleMessage(`sortIds: ${sortId}`)); const { @@ -167,6 +167,7 @@ export const searchAfterAndBulkCreate = async ({ searchResult.hits.hits[searchResult.hits.hits.length - 1]?._source['@timestamp'] ) : null; + searchResultSize += searchResult.hits.hits.length; // filter out the search results that match with the values found in the list. // the resulting set are valid signals that are not on the allowlist. @@ -186,14 +187,6 @@ export const searchAfterAndBulkCreate = async ({ break; } - // make sure we are not going to create more signals than maxSignals allows - if (signalsCreatedCount + filteredEvents.hits.hits.length > tuple.maxSignals) { - filteredEvents.hits.hits = filteredEvents.hits.hits.slice( - 0, - tuple.maxSignals - signalsCreatedCount - ); - } - const { bulkCreateDuration: bulkDuration, createdItemsCount: createdCount, @@ -218,7 +211,6 @@ export const searchAfterAndBulkCreate = async ({ }); logger.debug(buildRuleMessage(`created ${createdCount} signals`)); toReturn.createdSignalsCount += createdCount; - signalsCreatedCount += createdCount; if (bulkDuration) { toReturn.bulkCreateTimes.push(bulkDuration); }