From 16320cc249d5fd4df3255cbe8b2b499bfdd52d5a Mon Sep 17 00:00:00 2001 From: Andrew Goldstein Date: Sat, 16 Oct 2021 12:44:19 -0600 Subject: [PATCH 1/5] [Security Solution] Restores Alerts table local storage persistence and the Remove Column action (#114742) ## [Security Solution] Restores Alerts table local storage persistence and the Remove Column action This PR implements the following changes summarized below to address , as proposed [here](https://github.com/elastic/kibana/issues/113090#issuecomment-935143690): - Configures the `Columns` popover to be consistent with `Discover` - Changes the `Hide column` action to `Remove column`, to be consistent with `Discover` - Persists updates to the `Columns` popover order in `local storage` - Restores the feature to persist column widths in `local storage` ### Configures the `Columns` popover to be consistent with `Discover` - We now pass `false` to the `allowHide` [EuiDataGrid API](https://elastic.github.io/eui/#/tabular-content/data-grid): ![allow_hide](https://user-images.githubusercontent.com/4459398/136114714-02f25b97-86af-47e5-9adc-1177d5a2c715.png) This makes all `EuiDataGrid`-based views in the Security Solution consistent with `Discover`'s use of the `EuiDataGrid` `Columns` popover. In `7.15`, the `Columns` popover includes the _hide column_ toggle, as shown in the screenshot below: ![alerts_columns_popover_7_15](https://user-images.githubusercontent.com/4459398/136112441-455ddbeb-dea3-4837-81ad-32d6c82c11fe.png) _Above: The `Columns` popover in the `7.15` `Alerts` table_ The `Columns` popover in `Discover`'s `EuiDataGrid`-based table does not display the hide column toggle, as shown the screenshot below: ![columns_popover_discover](https://user-images.githubusercontent.com/4459398/136112856-7e42c822-2260-4759-ac78-5bea63a171c7.png) _Above: The `EuiDataGrid` `Columns` popover in `Discover`, in `master`_ Passing `false` to the `allowHide` [EuiDataGrid API](https://elastic.github.io/eui/#/tabular-content/data-grid) API makes the `Columns` popover in all `EuiDataGrid`-based views in the Security Solution consistent with `Discover`, as illustrated by the screenshot below: ![alerts_columns_popover_no_hide](https://user-images.githubusercontent.com/4459398/136112980-d4219fbd-1443-4612-8cdb-b97bee8b97ef.png) _Above: The `Columns` popover is now consistent with `Discover`_ ## Changes the `Hide column` action to `Remove column`, to be consistent with `Discover` - The `Hide column` action shown in the `7.15` alerts table is changed to `Remove column`, making it consistent with `Discover`'s use of `EuiDataGrid` In `7.15`, the `Alerts` table has a `Hide column` action, as shown in the screenshot below: ![hide_column](https://user-images.githubusercontent.com/4459398/136115681-9e0da144-a981-4352-8092-9368d74cd153.png) _Above: The `Hide Column` action in the `7.15` `Alerts` table_ In `7.15`, clicking the `Hide Column` action shown in the screenshot above hides the column, but does not remove it. In `7.15`, columns may only be removed by un-checking them in the `Fields` browser, or by un-toggling them in the Alerts / Events details popover. Both of those methods require multiple clicks, and require uses to re-find the field in the modal or popover before it may be toggled for removal. In `Discover`, users don't hide columns. In `Discover`, users directly remove columns by clicking the `Remove column` action, shown in the screenshot below: ![discover_remove_column](https://user-images.githubusercontent.com/4459398/136114295-f018a561-f9ee-4ce4-a9c6-0fcd7f71e67b.png) _Above: The `Remove column` action in `Discover`'s use of `EuiDataGrid` in `master`_ All `EuiDataGrid`-based views in the Security Solution were made consistent with `Discover` by replacing the `Hide column` action with `Remove column`, per the screenshot below: ![remove_column_after](https://user-images.githubusercontent.com/4459398/137047582-3c4d6cb0-ac12-4c50-9c34-0c4ef5536550.png) _Above: The `Remove column` action in the Alerts table_ Note: the `Remove column` action shown above appears as the last item in the popover because it's specified via the `EuiDataGrid` `EuiDataGridColumnActions` > `additonal` API, which appends additonal actions to the end of popover, after the built-in actions: ![additional](https://user-images.githubusercontent.com/4459398/137047825-625002b3-5cd6-4b3e-87da-e76dbaf2a827.png) ## Persists updates to the `Columns` popover order in `local storage` - Persist column order updates to `local storage` when users update the order of columns via the `Columns` popover The following PR restored partial support for persisting columns across page refreshes via `local storage`, but the Redux store was not updated when users sort columns via the `Columns` popover, an shown in the animated gif below: ![ordering_via_columns](https://user-images.githubusercontent.com/4459398/136119497-65f76f49-091c-4a45-b8d3-1e5ef80ccbb2.gif) _Above: Ordering via the `Columns` popover is not persisted to `local storage` in `7.15`_ This PR utilizes the `setVisibleColumns` [EuiDataGrid API](https://elastic.github.io/eui/#/tabular-content/data-grid) API as a callback to update Redux when the columns are sorted, which will in-turn update `local storage` to persist the new order across page refreshes: ![setVisibleColumns](https://user-images.githubusercontent.com/4459398/136117249-628bb147-a860-4ccf-811a-0e57a99296fb.png) ## Restores the feature to persist column widths in `local storage` In previous releases, resized column widths were peristed in `local storage` to persist across page refreshes, as documented in : ``` { "detections-page":{ "id":"detections-page", "activeTab":"query", "prevActiveTab":"query", "columns":[ { "category":"base", "columnHeaderType":"not-filtered", "description":"Date/time when the event originated. This is the date/time extracted from the event, typically representing when the event was generated by the source. If the event source has no original timestamp, this value is typically populated by the first time the event was received by the pipeline. Required field for all events.", "example":"2016-05-23T08:05:34.853Z", "id":"@timestamp", "type":"date", "aggregatable":true, "width":190 }, { "category":"cloud", "columnHeaderType":"not-filtered", "description":"The cloud account or organization id used to identify different entities in a multi-tenant environment. Examples: AWS account id, Google Cloud ORG Id, or other unique identifier.", "example":"666777888999", "id":"cloud.account.id", "type":"string", "aggregatable":true, "width":180 }, { "category":"cloud", "columnHeaderType":"not-filtered", "description":"Availability zone in which this host is running.", "example":"us-east-1c", "id":"cloud.availability_zone", "type":"string", "aggregatable":true, "width":180 }, // ... } ], // ... } } ``` _Above: column widths were persisted to `local storage` in previous release, (going at least back to `7.12`)_ In this PR, we utilize the `onColumnResize` [EuiDataGrid API](https://elastic.github.io/eui/#/tabular-content/data-grid) API as a callback to update Redux when the columns are sorted via the `Columns` popover. Updating Redux will in-turn update `local storage`, so resized columns widths will persist across page refreshes: ![onColumnResize](https://user-images.githubusercontent.com/4459398/136120062-3b0bebce-9c44-47fc-9956-48fe07a30f83.png) ### Other changes The Alerts page `Trend` chart and table were updated to include the following additional `Stack by` fields (CC @paulewing): ``` process.name file.name hash.sha256 ``` per the before / after screenshots below: ![alerts-trend-before](https://user-images.githubusercontent.com/4459398/137045011-7da4530b-0259-4fd4-b903-9eee6c26d02f.png) _Above: The Alerts `Trend` Stack by fields in `7.15` (before)_ ![alerts-trend-after](https://user-images.githubusercontent.com/4459398/137045023-d0ae987c-a474-4123-a05b-a6ad2fc52922.png) _Above: The Alerts `Trend` `Stack by` fields (after the addition of the `process.name`, `file.name`, and `hash.sha256` fields)_ CC: @monina-n @paulewing --- .../components/alerts_kpis/common/config.ts | 3 + .../components/alerts_kpis/common/types.ts | 5 +- .../timelines/store/timeline/actions.ts | 2 + .../timeline/epic_local_storage.test.tsx | 33 +++++ .../store/timeline/epic_local_storage.ts | 4 + .../body/column_headers/column_header.tsx | 4 +- .../body/column_headers/helpers.test.tsx | 1 + .../t_grid/body/column_headers/helpers.tsx | 1 + .../body/column_headers/translations.ts | 4 - .../components/t_grid/body/index.test.tsx | 55 +++++++++ .../public/components/t_grid/body/index.tsx | 52 ++++++-- .../timelines/public/store/t_grid/actions.ts | 11 ++ .../public/store/t_grid/helpers.test.tsx | 115 +++++++++++++++++- .../timelines/public/store/t_grid/helpers.ts | 58 +++++++++ .../timelines/public/store/t_grid/reducer.ts | 21 ++++ .../translations/translations/ja-JP.json | 1 - .../translations/translations/zh-CN.json | 1 - 17 files changed, 352 insertions(+), 19 deletions(-) diff --git a/x-pack/plugins/security_solution/public/detections/components/alerts_kpis/common/config.ts b/x-pack/plugins/security_solution/public/detections/components/alerts_kpis/common/config.ts index cb5a23e711974..a835628fae6cf 100644 --- a/x-pack/plugins/security_solution/public/detections/components/alerts_kpis/common/config.ts +++ b/x-pack/plugins/security_solution/public/detections/components/alerts_kpis/common/config.ts @@ -19,6 +19,9 @@ export const alertsStackByOptions: AlertsStackByOption[] = [ { text: 'signal.rule.name', value: 'signal.rule.name' }, { text: 'source.ip', value: 'source.ip' }, { text: 'user.name', value: 'user.name' }, + { text: 'process.name', value: 'process.name' }, + { text: 'file.name', value: 'file.name' }, + { text: 'hash.sha256', value: 'hash.sha256' }, ]; export const DEFAULT_STACK_BY_FIELD = 'signal.rule.name'; diff --git a/x-pack/plugins/security_solution/public/detections/components/alerts_kpis/common/types.ts b/x-pack/plugins/security_solution/public/detections/components/alerts_kpis/common/types.ts index 833c05bfc7a79..f561c3f6faa21 100644 --- a/x-pack/plugins/security_solution/public/detections/components/alerts_kpis/common/types.ts +++ b/x-pack/plugins/security_solution/public/detections/components/alerts_kpis/common/types.ts @@ -21,4 +21,7 @@ export type AlertsStackByField = | 'signal.rule.type' | 'signal.rule.name' | 'source.ip' - | 'user.name'; + | 'user.name' + | 'process.name' + | 'file.name' + | 'hash.sha256'; diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/actions.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/actions.ts index 3750bc22ddc69..95ad6c5d44ca3 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/actions.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/actions.ts @@ -37,7 +37,9 @@ export const { setSelected, setTGridSelectAll, toggleDetailPanel, + updateColumnOrder, updateColumns, + updateColumnWidth, updateIsLoading, updateItemsPerPage, updateItemsPerPageOptions, diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_local_storage.test.tsx b/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_local_storage.test.tsx index 01bc589393d2e..131f255b5a7a7 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_local_storage.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_local_storage.test.tsx @@ -25,7 +25,9 @@ import { removeColumn, upsertColumn, applyDeltaToColumnWidth, + updateColumnOrder, updateColumns, + updateColumnWidth, updateItemsPerPage, updateSort, } from './actions'; @@ -168,4 +170,35 @@ describe('epicLocalStorage', () => { ); await waitFor(() => expect(addTimelineInStorageMock).toHaveBeenCalled()); }); + + it('persists updates to the column order to local storage', async () => { + shallow( + + + + ); + store.dispatch( + updateColumnOrder({ + columnIds: ['event.severity', '@timestamp', 'event.category'], + id: 'test', + }) + ); + await waitFor(() => expect(addTimelineInStorageMock).toHaveBeenCalled()); + }); + + it('persists updates to the column width to local storage', async () => { + shallow( + + + + ); + store.dispatch( + updateColumnWidth({ + columnId: 'event.severity', + id: 'test', + width: 123, + }) + ); + await waitFor(() => expect(addTimelineInStorageMock).toHaveBeenCalled()); + }); }); diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_local_storage.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_local_storage.ts index 9a889e9ec1af8..6c4ebf91b7adf 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_local_storage.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_local_storage.ts @@ -19,6 +19,8 @@ import { applyDeltaToColumnWidth, setExcludedRowRendererIds, updateColumns, + updateColumnOrder, + updateColumnWidth, updateItemsPerPage, updateSort, } from './actions'; @@ -30,6 +32,8 @@ const timelineActionTypes = [ upsertColumn.type, applyDeltaToColumnWidth.type, updateColumns.type, + updateColumnOrder.type, + updateColumnWidth.type, updateItemsPerPage.type, updateSort.type, setExcludedRowRendererIds.type, diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/column_headers/column_header.tsx b/x-pack/plugins/timelines/public/components/t_grid/body/column_headers/column_header.tsx index 033292711c5af..4e6db10cc8bce 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/body/column_headers/column_header.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/body/column_headers/column_header.tsx @@ -161,8 +161,8 @@ const ColumnHeaderComponent: React.FC = ({ id: 0, items: [ { - icon: , - name: i18n.HIDE_COLUMN, + icon: , + name: i18n.REMOVE_COLUMN, onClick: () => { dispatch(tGridActions.removeColumn({ id: timelineId, columnId: header.id })); handleClosePopOverTrigger(); diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/column_headers/helpers.test.tsx b/x-pack/plugins/timelines/public/components/t_grid/body/column_headers/helpers.test.tsx index 2e684b9eda989..47fcb8c8e1509 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/body/column_headers/helpers.test.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/body/column_headers/helpers.test.tsx @@ -98,6 +98,7 @@ describe('helpers', () => { describe('getColumnHeaders', () => { // additional properties used by `EuiDataGrid`: const actions = { + showHide: false, showSortAsc: true, showSortDesc: true, }; diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/column_headers/helpers.tsx b/x-pack/plugins/timelines/public/components/t_grid/body/column_headers/helpers.tsx index c658000e6d331..66ec3ec1c399f 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/body/column_headers/helpers.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/body/column_headers/helpers.tsx @@ -27,6 +27,7 @@ import { allowSorting } from '../helpers'; const defaultActions: EuiDataGridColumnActions = { showSortAsc: true, showSortDesc: true, + showHide: false, }; const getAllBrowserFields = (browserFields: BrowserFields): Array> => diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/column_headers/translations.ts b/x-pack/plugins/timelines/public/components/t_grid/body/column_headers/translations.ts index 2d4fbcbd54cfa..202eef8d675b8 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/body/column_headers/translations.ts +++ b/x-pack/plugins/timelines/public/components/t_grid/body/column_headers/translations.ts @@ -23,10 +23,6 @@ export const FULL_SCREEN = i18n.translate('xpack.timelines.timeline.fullScreenBu defaultMessage: 'Full screen', }); -export const HIDE_COLUMN = i18n.translate('xpack.timelines.timeline.hideColumnLabel', { - defaultMessage: 'Hide column', -}); - export const SORT_AZ = i18n.translate('xpack.timelines.timeline.sortAZLabel', { defaultMessage: 'Sort A-Z', }); diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/index.test.tsx b/x-pack/plugins/timelines/public/components/t_grid/body/index.test.tsx index 50764af3c7f2f..5a7ae6e407b0b 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/body/index.test.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/body/index.test.tsx @@ -6,9 +6,11 @@ */ import React from 'react'; +import { fireEvent, render, screen } from '@testing-library/react'; import { BodyComponent, StatefulBodyProps } from '.'; import { Sort } from './sort'; +import { REMOVE_COLUMN } from './column_headers/translations'; import { Direction } from '../../../../common/search_strategy'; import { useMountAppended } from '../../utils/use_mount_appended'; import { defaultHeaders, mockBrowserFields, mockTimelineData, TestProviders } from '../../../mock'; @@ -273,4 +275,57 @@ describe('Body', () => { .find((c) => c.id === 'signal.rule.risk_score')?.cellActions ).toBeUndefined(); }); + + test('it does NOT render switches for hiding columns in the `EuiDataGrid` `Columns` popover', async () => { + render( + + + + ); + + // Click the `EuidDataGrid` `Columns` button to open the popover: + fireEvent.click(screen.getByTestId('dataGridColumnSelectorButton')); + + // `EuiDataGrid` renders switches for hiding in the `Columns` popover when `showColumnSelector.allowHide` is `true` + const switches = await screen.queryAllByRole('switch'); + + expect(switches.length).toBe(0); // no switches are rendered, because `allowHide` is `false` + }); + + test('it dispatches the `REMOVE_COLUMN` action when a user clicks `Remove column` in the column header popover', async () => { + render( + + + + ); + + // click the `@timestamp` column header to display the popover + fireEvent.click(screen.getByText('@timestamp')); + + // click the `Remove column` action in the popover + fireEvent.click(await screen.getByText(REMOVE_COLUMN)); + + expect(mockDispatch).toBeCalledWith({ + payload: { columnId: '@timestamp', id: 'timeline-test' }, + type: 'x-pack/timelines/t-grid/REMOVE_COLUMN', + }); + }); + + test('it dispatches the `UPDATE_COLUMN_WIDTH` action when a user resizes a column', async () => { + render( + + + + ); + + // simulate resizing the column + fireEvent.mouseDown(screen.getAllByTestId('dataGridColumnResizer')[0]); + fireEvent.mouseMove(screen.getAllByTestId('dataGridColumnResizer')[0]); + fireEvent.mouseUp(screen.getAllByTestId('dataGridColumnResizer')[0]); + + expect(mockDispatch).toBeCalledWith({ + payload: { columnId: '@timestamp', id: 'timeline-test', width: NaN }, + type: 'x-pack/timelines/t-grid/UPDATE_COLUMN_WIDTH', + }); + }); }); diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/index.tsx b/x-pack/plugins/timelines/public/components/t_grid/body/index.tsx index 619571a0c8e81..9e43c16fd5e6f 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/body/index.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/body/index.tsx @@ -75,6 +75,7 @@ import { ViewSelection } from '../event_rendered_view/selector'; import { EventRenderedView } from '../event_rendered_view'; import { useDataGridHeightHack } from './height_hack'; import { Filter } from '../../../../../../../src/plugins/data/public'; +import { REMOVE_COLUMN } from './column_headers/translations'; const StatefulAlertStatusBulkActions = lazy( () => import('../toolbar/bulk_actions/alert_status_bulk_actions') @@ -497,7 +498,7 @@ export const BodyComponent = React.memo( showFullScreenSelector: false, } : { - showColumnSelector: { allowHide: true, allowReorder: true }, + showColumnSelector: { allowHide: false, allowReorder: true }, showSortSelector: true, showFullScreenSelector: true, }), @@ -559,13 +560,32 @@ export const BodyComponent = React.memo( [columnHeaders, dispatch, id, loadPage] ); - const [visibleColumns, setVisibleColumns] = useState(() => - columnHeaders.map(({ id: cid }) => cid) - ); // initializes to the full set of columns + const visibleColumns = useMemo(() => columnHeaders.map(({ id: cid }) => cid), [columnHeaders]); // the full set of columns - useEffect(() => { - setVisibleColumns(columnHeaders.map(({ id: cid }) => cid)); - }, [columnHeaders]); + const onColumnResize = useCallback( + ({ columnId, width }: { columnId: string; width: number }) => { + dispatch( + tGridActions.updateColumnWidth({ + columnId, + id, + width, + }) + ); + }, + [dispatch, id] + ); + + const onSetVisibleColumns = useCallback( + (newVisibleColumns: string[]) => { + dispatch( + tGridActions.updateColumnOrder({ + columnIds: newVisibleColumns, + id, + }) + ); + }, + [dispatch, id] + ); const setEventsLoading = useCallback( ({ eventIds, isLoading: loading }) => { @@ -654,6 +674,19 @@ export const BodyComponent = React.memo( return { ...header, + actions: { + ...header.actions, + additional: [ + { + iconType: 'cross', + label: REMOVE_COLUMN, + onClick: () => { + dispatch(tGridActions.removeColumn({ id, columnId: header.id })); + }, + size: 'xs', + }, + ], + }, ...(hasCellActions(header.id) ? { cellActions: @@ -663,7 +696,7 @@ export const BodyComponent = React.memo( : {}), }; }), - [columnHeaders, defaultCellActions, browserFields, data, pageSize, id] + [columnHeaders, defaultCellActions, browserFields, data, pageSize, id, dispatch] ); const renderTGridCellValue = useMemo(() => { @@ -761,7 +794,7 @@ export const BodyComponent = React.memo( data-test-subj="body-data-grid" aria-label={i18n.TGRID_BODY_ARIA_LABEL} columns={columnsWithCellActions} - columnVisibility={{ visibleColumns, setVisibleColumns }} + columnVisibility={{ visibleColumns, setVisibleColumns: onSetVisibleColumns }} gridStyle={gridStyle} leadingControlColumns={leadingTGridControlColumns} trailingControlColumns={trailingTGridControlColumns} @@ -769,6 +802,7 @@ export const BodyComponent = React.memo( rowCount={totalItems} renderCellValue={renderTGridCellValue} sorting={{ columns: sortingColumns, onSort }} + onColumnResize={onColumnResize} pagination={{ pageIndex: activePage, pageSize, diff --git a/x-pack/plugins/timelines/public/store/t_grid/actions.ts b/x-pack/plugins/timelines/public/store/t_grid/actions.ts index a039a236fb186..feab12b616c78 100644 --- a/x-pack/plugins/timelines/public/store/t_grid/actions.ts +++ b/x-pack/plugins/timelines/public/store/t_grid/actions.ts @@ -32,6 +32,17 @@ export const applyDeltaToColumnWidth = actionCreator<{ delta: number; }>('APPLY_DELTA_TO_COLUMN_WIDTH'); +export const updateColumnOrder = actionCreator<{ + columnIds: string[]; + id: string; +}>('UPDATE_COLUMN_ORDER'); + +export const updateColumnWidth = actionCreator<{ + columnId: string; + id: string; + width: number; +}>('UPDATE_COLUMN_WIDTH'); + export type ToggleDetailPanel = TimelineExpandedDetailType & { tabType?: TimelineTabs; timelineId: string; diff --git a/x-pack/plugins/timelines/public/store/t_grid/helpers.test.tsx b/x-pack/plugins/timelines/public/store/t_grid/helpers.test.tsx index 121e5bda78ed8..1e1fbe290a115 100644 --- a/x-pack/plugins/timelines/public/store/t_grid/helpers.test.tsx +++ b/x-pack/plugins/timelines/public/store/t_grid/helpers.test.tsx @@ -7,7 +7,11 @@ import { SortColumnTimeline } from '../../../common'; import { tGridDefaults } from './defaults'; -import { setInitializeTgridSettings } from './helpers'; +import { + setInitializeTgridSettings, + updateTGridColumnOrder, + updateTGridColumnWidth, +} from './helpers'; import { mockGlobalState } from '../../mock/global_state'; import { TGridModelSettings } from '.'; @@ -57,3 +61,112 @@ describe('setInitializeTgridSettings', () => { expect(result).toBe(timelineById); }); }); + +describe('updateTGridColumnOrder', () => { + test('it returns the columns in the new expected order', () => { + const originalIdOrder = defaultTimelineById.test.columns.map((x) => x.id); // ['@timestamp', 'event.severity', 'event.category', '...'] + + // the new order swaps the positions of the first and second columns: + const newIdOrder = [originalIdOrder[1], originalIdOrder[0], ...originalIdOrder.slice(2)]; // ['event.severity', '@timestamp', 'event.category', '...'] + + expect( + updateTGridColumnOrder({ + columnIds: newIdOrder, + id: 'test', + timelineById: defaultTimelineById, + }) + ).toEqual({ + ...defaultTimelineById, + test: { + ...defaultTimelineById.test, + columns: [ + defaultTimelineById.test.columns[1], // event.severity + defaultTimelineById.test.columns[0], // @timestamp + ...defaultTimelineById.test.columns.slice(2), // all remaining columns + ], + }, + }); + }); + + test('it omits unknown column IDs when re-ordering columns', () => { + const originalIdOrder = defaultTimelineById.test.columns.map((x) => x.id); // ['@timestamp', 'event.severity', 'event.category', '...'] + const unknownColumId = 'does.not.exist'; + const newIdOrder = [originalIdOrder[0], unknownColumId, ...originalIdOrder.slice(1)]; // ['@timestamp', 'does.not.exist', 'event.severity', 'event.category', '...'] + + expect( + updateTGridColumnOrder({ + columnIds: newIdOrder, + id: 'test', + timelineById: defaultTimelineById, + }) + ).toEqual({ + ...defaultTimelineById, + test: { + ...defaultTimelineById.test, + }, + }); + }); + + test('it returns an empty collection of columns if none of the new column IDs are found', () => { + const newIdOrder = ['this.id.does.NOT.exist', 'this.id.also.does.NOT.exist']; // all unknown IDs + + expect( + updateTGridColumnOrder({ + columnIds: newIdOrder, + id: 'test', + timelineById: defaultTimelineById, + }) + ).toEqual({ + ...defaultTimelineById, + test: { + ...defaultTimelineById.test, + columns: [], // <-- empty, because none of the new column IDs match the old IDs + }, + }); + }); +}); + +describe('updateTGridColumnWidth', () => { + test("it updates (only) the specified column's width", () => { + const columnId = '@timestamp'; + const width = 1234; + + const expectedUpdatedColumn = { + ...defaultTimelineById.test.columns[0], // @timestamp + initialWidth: width, + }; + + expect( + updateTGridColumnWidth({ + columnId, + id: 'test', + timelineById: defaultTimelineById, + width, + }) + ).toEqual({ + ...defaultTimelineById, + test: { + ...defaultTimelineById.test, + columns: [expectedUpdatedColumn, ...defaultTimelineById.test.columns.slice(1)], + }, + }); + }); + + test('it is a noop if the the specified column is unknown', () => { + const unknownColumId = 'does.not.exist'; + + expect( + updateTGridColumnWidth({ + columnId: unknownColumId, + id: 'test', + timelineById: defaultTimelineById, + width: 90210, + }) + ).toEqual({ + ...defaultTimelineById, + test: { + ...defaultTimelineById.test, + }, + }); + }); +}); diff --git a/x-pack/plugins/timelines/public/store/t_grid/helpers.ts b/x-pack/plugins/timelines/public/store/t_grid/helpers.ts index f7b0d86f88621..34de86d32a9b2 100644 --- a/x-pack/plugins/timelines/public/store/t_grid/helpers.ts +++ b/x-pack/plugins/timelines/public/store/t_grid/helpers.ts @@ -8,6 +8,7 @@ import { omit, union } from 'lodash/fp'; import { isEmpty } from 'lodash'; +import { EuiDataGridColumn } from '@elastic/eui'; import type { ToggleDetailPanel } from './actions'; import { TGridPersistInput, TimelineById, TimelineId } from './types'; import type { TGridModel, TGridModelSettings } from './model'; @@ -232,6 +233,63 @@ export const applyDeltaToTimelineColumnWidth = ({ }; }; +type Columns = Array< + Pick & ColumnHeaderOptions +>; + +export const updateTGridColumnOrder = ({ + columnIds, + id, + timelineById, +}: { + columnIds: string[]; + id: string; + timelineById: TimelineById; +}): TimelineById => { + const timeline = timelineById[id]; + + const columns = columnIds.reduce((acc, cid) => { + const columnIndex = timeline.columns.findIndex((c) => c.id === cid); + + return columnIndex !== -1 ? [...acc, timeline.columns[columnIndex]] : acc; + }, []); + + return { + ...timelineById, + [id]: { + ...timeline, + columns, + }, + }; +}; + +export const updateTGridColumnWidth = ({ + columnId, + id, + timelineById, + width, +}: { + columnId: string; + id: string; + timelineById: TimelineById; + width: number; +}): TimelineById => { + const timeline = timelineById[id]; + + const columns = timeline.columns.map((x) => ({ + ...x, + initialWidth: x.id === columnId ? width : x.initialWidth, + })); + + return { + ...timelineById, + [id]: { + ...timeline, + columns, + }, + }; +}; + interface UpdateTimelineColumnsParams { id: string; columns: ColumnHeaderOptions[]; diff --git a/x-pack/plugins/timelines/public/store/t_grid/reducer.ts b/x-pack/plugins/timelines/public/store/t_grid/reducer.ts index d29240d5658db..d3af1dc4e9b30 100644 --- a/x-pack/plugins/timelines/public/store/t_grid/reducer.ts +++ b/x-pack/plugins/timelines/public/store/t_grid/reducer.ts @@ -23,7 +23,9 @@ import { setSelected, setTimelineUpdatedAt, toggleDetailPanel, + updateColumnOrder, updateColumns, + updateColumnWidth, updateIsLoading, updateItemsPerPage, updateItemsPerPageOptions, @@ -40,6 +42,8 @@ import { setDeletedTimelineEvents, setLoadingTimelineEvents, setSelectedTimelineEvents, + updateTGridColumnOrder, + updateTGridColumnWidth, updateTimelineColumns, updateTimelineItemsPerPage, updateTimelinePerPageOptions, @@ -91,6 +95,23 @@ export const tGridReducer = reducerWithInitialState(initialTGridState) timelineById: state.timelineById, }), })) + .case(updateColumnOrder, (state, { id, columnIds }) => ({ + ...state, + timelineById: updateTGridColumnOrder({ + columnIds, + id, + timelineById: state.timelineById, + }), + })) + .case(updateColumnWidth, (state, { id, columnId, width }) => ({ + ...state, + timelineById: updateTGridColumnWidth({ + columnId, + id, + timelineById: state.timelineById, + width, + }), + })) .case(removeColumn, (state, { id, columnId }) => ({ ...state, timelineById: removeTimelineColumn({ diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 6a97078082117..d67126fdad4bb 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -24458,7 +24458,6 @@ "xpack.timelines.timeline.fieldTooltip": "フィールド", "xpack.timelines.timeline.flyout.pane.removeColumnButtonLabel": "列を削除", "xpack.timelines.timeline.fullScreenButton": "全画面", - "xpack.timelines.timeline.hideColumnLabel": "列を非表示", "xpack.timelines.timeline.openedAlertFailedToastMessage": "アラートを開けませんでした", "xpack.timelines.timeline.openSelectedTitle": "選択した項目を開く", "xpack.timelines.timeline.properties.timelineToggleButtonAriaLabel": "タイムライン {title} を{isOpen, select, false {開く} true {閉じる} other {切り替える}}", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 6e09814d015cc..598a5c24bdee2 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -24874,7 +24874,6 @@ "xpack.timelines.timeline.fieldTooltip": "字段", "xpack.timelines.timeline.flyout.pane.removeColumnButtonLabel": "移除列", "xpack.timelines.timeline.fullScreenButton": "全屏", - "xpack.timelines.timeline.hideColumnLabel": "隐藏列", "xpack.timelines.timeline.openedAlertFailedToastMessage": "无法打开告警", "xpack.timelines.timeline.openedAlertSuccessToastMessage": "已成功打开 {totalAlerts} 个{totalAlerts, plural, other {告警}}。", "xpack.timelines.timeline.openSelectedTitle": "打开所选", From 7d66002da28a0b24b25dd5d6ac7adf88b13e179f Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Sat, 16 Oct 2021 16:21:58 -0500 Subject: [PATCH 2/5] Bump node to 16.11.1 (#110684) * Bump node to ^16 * fix comment * use jest timers * bump mock-fs * Fix core type errors * Unskipping tests that work on my machine * skip new unhandled promise rejection * Fix Nodejs v16 regression due to https://github.com/nodejs/node/issues/38924 * Fix failing concurrent connections collector test * Fix types after merge from master * update servicenow test * Skip unhandledRejection tests * Skip tests with unhandled promise rejection * Fix discover jest failures * bump node to 16.11.1 * revert timeout increase * skip unhandled promise rejection * rm jest import * skip unhandled promise rejection Co-authored-by: Rudolf Meijering Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Tim Roes --- .ci/Dockerfile | 4 +-- .node-version | 2 +- .nvmrc | 2 +- WORKSPACE.bazel | 12 +++---- config/node.options | 3 ++ package.json | 10 +++--- .../kbn-dev-utils/src/proc_runner/proc.ts | 4 +-- packages/kbn-i18n/BUILD.bazel | 1 + packages/kbn-test/src/jest/run.ts | 14 ++++++++ src/core/server/bootstrap.ts | 2 +- .../environment/environment_service.test.ts | 3 +- .../integration_tests/tracing.test.ts | 2 +- src/core/server/http/http_server.test.ts | 4 +-- src/core/server/http/router/request.ts | 6 ++-- .../http/router/validator/validator.test.ts | 2 +- .../rolling_file_appender.test.ts | 4 +-- .../event_loop_delays_monitor.ts | 4 +-- .../server_collector.test.ts | 4 +++ src/core/server/status/plugins_status.ts | 2 +- src/core/server/status/status_service.ts | 6 ++-- .../build/tasks/patch_native_modules_task.ts | 16 ++++----- .../embeddable/grid/dashboard_grid.test.tsx | 15 ++++++--- .../viewport/dashboard_viewport.test.tsx | 19 +++++++---- .../view_saved_search_action.test.ts | 8 +++++ .../public/services/telemetry_sender.test.ts | 15 +++------ ...ualization_saved_object_migrations.test.ts | 2 +- src/setup_node_env/exit_on_warning.js | 16 +++++++++ .../apm/ftr_e2e/cypress/tasks/es_archiver.ts | 6 ++-- .../document_creation_logic.test.ts | 2 +- .../server/services/epm/registry/requests.ts | 1 - .../home/indices_tab.test.ts | 3 +- .../common/decrypt_job_headers.test.ts | 2 +- .../export_types/csv/execute_job.test.ts | 4 ++- .../public/common/mock/utils.ts | 7 ++-- .../search_exceptions.test.tsx | 1 + .../endpoint_hosts/store/middleware.test.ts | 3 +- .../policy_trusted_apps_layout.test.tsx | 3 +- .../stack_alerts/server/plugin.test.ts | 3 +- .../plugins/uptime/e2e/tasks/es_archiver.ts | 6 ++-- .../fleet_package/custom_fields.test.tsx | 3 +- .../monitor_list_drawer.test.tsx | 1 - .../actions/builtin_action_types/jira.ts | 27 ++------------- .../actions/builtin_action_types/resilient.ts | 27 ++------------- .../builtin_action_types/servicenow_itsm.ts | 27 ++------------- .../builtin_action_types/servicenow_sir.ts | 27 ++------------- .../actions/builtin_action_types/swimlane.ts | 27 ++------------- yarn.lock | 33 ++++++++----------- 47 files changed, 164 insertions(+), 231 deletions(-) diff --git a/.ci/Dockerfile b/.ci/Dockerfile index d3ea74ca38969..29ed08c84b23e 100644 --- a/.ci/Dockerfile +++ b/.ci/Dockerfile @@ -1,7 +1,7 @@ # NOTE: This Dockerfile is ONLY used to run certain tasks in CI. It is not used to run Kibana or as a distributable. # If you're looking for the Kibana Docker image distributable, please see: src/dev/build/tasks/os_packages/docker_generator/templates/dockerfile.template.ts -ARG NODE_VERSION=14.17.6 +ARG NODE_VERSION=16.11.1 FROM node:${NODE_VERSION} AS base @@ -10,7 +10,7 @@ RUN apt-get update && \ libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 \ libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 \ libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 \ - libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget openjdk-8-jre && \ + libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget openjdk-11-jre && \ rm -rf /var/lib/apt/lists/* RUN curl -sSL https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \ diff --git a/.node-version b/.node-version index 5595ae1aa9e4c..141e9a2a2cef0 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -14.17.6 +16.11.1 diff --git a/.nvmrc b/.nvmrc index 5595ae1aa9e4c..141e9a2a2cef0 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -14.17.6 +16.11.1 diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index 3ae3f202a3bfd..287b376037abe 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -27,13 +27,13 @@ check_rules_nodejs_version(minimum_version_string = "3.8.0") # we can update that rule. node_repositories( node_repositories = { - "14.17.6-darwin_amd64": ("node-v14.17.6-darwin-x64.tar.gz", "node-v14.17.6-darwin-x64", "e3e4c02240d74fb1dc8a514daa62e5de04f7eaee0bcbca06a366ece73a52ad88"), - "14.17.6-linux_arm64": ("node-v14.17.6-linux-arm64.tar.xz", "node-v14.17.6-linux-arm64", "9c4f3a651e03cd9b5bddd33a80e8be6a6eb15e518513e410bb0852a658699156"), - "14.17.6-linux_s390x": ("node-v14.17.6-linux-s390x.tar.xz", "node-v14.17.6-linux-s390x", "3677f35b97608056013b5368f86eecdb044bdccc1b3976c1d4448736c37b6a0c"), - "14.17.6-linux_amd64": ("node-v14.17.6-linux-x64.tar.xz", "node-v14.17.6-linux-x64", "3bbe4faf356738d88b45be222bf5e858330541ff16bd0d4cfad36540c331461b"), - "14.17.6-windows_amd64": ("node-v14.17.6-win-x64.zip", "node-v14.17.6-win-x64", "b83e9ce542fda7fc519cec6eb24a2575a84862ea4227dedc171a8e0b5b614ac0"), + "16.11.1-darwin_amd64": ("node-v16.11.1-darwin-x64.tar.gz", "node-v16.11.1-darwin-x64", "ba54b8ed504bd934d03eb860fefe991419b4209824280d4274f6a911588b5e45"), + "16.11.1-linux_arm64": ("node-v16.11.1-linux-arm64.tar.xz", "node-v16.11.1-linux-arm64", "083fc51f0ea26de9041aaf9821874651a9fd3b20d1cf57071ce6b523a0436f17"), + "16.11.1-linux_s390x": ("node-v16.11.1-linux-s390x.tar.xz", "node-v16.11.1-linux-s390x", "855b5c83c2ccb05273d50bb04376335c68d47df57f3187cdebe1f22b972d2825"), + "16.11.1-linux_amd64": ("node-v16.11.1-linux-x64.tar.xz", "node-v16.11.1-linux-x64", "493bcc9b660eff983a6de65a0f032eb2717f57207edf74c745bcb86e360310b3"), + "16.11.1-windows_amd64": ("node-v16.11.1-win-x64.zip", "node-v16.11.1-win-x64", "4d3c179b82d42e66e321c3948a4e332ed78592917a69d38b86e3a242d7e62fb7"), }, - node_version = "14.17.6", + node_version = "16.11.1", node_urls = [ "https://nodejs.org/dist/v{version}/{filename}", ], diff --git a/config/node.options b/config/node.options index 2927d1b576716..2585745249706 100644 --- a/config/node.options +++ b/config/node.options @@ -4,3 +4,6 @@ ## max size of old space in megabytes #--max-old-space-size=4096 + +## do not terminate process on unhandled promise rejection + --unhandled-rejections=warn diff --git a/package.json b/package.json index 9341ecd0bae35..3254077fd5083 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "url": "https://github.com/elastic/kibana.git" }, "resolutions": { - "**/@types/node": "14.14.44", + "**/@types/node": "16.10.2", "**/chokidar": "^3.4.3", "**/deepmerge": "^4.2.2", "**/fast-deep-equal": "^3.1.1", @@ -87,7 +87,7 @@ "**/underscore": "^1.13.1" }, "engines": { - "node": "14.17.6", + "node": "16.11.1", "yarn": "^1.21.1" }, "dependencies": { @@ -565,12 +565,12 @@ "@types/minimatch": "^2.0.29", "@types/minimist": "^1.2.1", "@types/mocha": "^8.2.0", - "@types/mock-fs": "^4.10.0", + "@types/mock-fs": "^4.13.1", "@types/moment-timezone": "^0.5.12", "@types/mustache": "^0.8.31", "@types/ncp": "^2.0.1", "@types/nock": "^10.0.3", - "@types/node": "14.14.44", + "@types/node": "16.10.2", "@types/node-fetch": "^2.5.7", "@types/node-forge": "^0.10.5", "@types/nodemailer": "^6.4.0", @@ -758,7 +758,7 @@ "mocha-junit-reporter": "^2.0.0", "mochawesome": "^6.2.1", "mochawesome-merge": "^4.2.0", - "mock-fs": "^4.12.0", + "mock-fs": "^5.1.1", "mock-http-server": "1.3.0", "ms-chromium-edge-driver": "^0.4.2", "multimatch": "^4.0.0", diff --git a/packages/kbn-dev-utils/src/proc_runner/proc.ts b/packages/kbn-dev-utils/src/proc_runner/proc.ts index e04a189baf5cd..c9a520de6eb4d 100644 --- a/packages/kbn-dev-utils/src/proc_runner/proc.ts +++ b/packages/kbn-dev-utils/src/proc_runner/proc.ts @@ -131,7 +131,7 @@ export function startProc(name: string, options: ProcOptions, log: ToolingLog) { await withTimeout( async () => { log.debug(`Sending "${signal}" to proc "${name}"`); - await treeKillAsync(childProcess.pid, signal); + await treeKillAsync(childProcess.pid!, signal); await outcomePromise; }, STOP_TIMEOUT, @@ -139,7 +139,7 @@ export function startProc(name: string, options: ProcOptions, log: ToolingLog) { log.warning( `Proc "${name}" was sent "${signal}" didn't emit the "exit" or "error" events after ${STOP_TIMEOUT} ms, sending SIGKILL` ); - await treeKillAsync(childProcess.pid, 'SIGKILL'); + await treeKillAsync(childProcess.pid!, 'SIGKILL'); } ); diff --git a/packages/kbn-i18n/BUILD.bazel b/packages/kbn-i18n/BUILD.bazel index 256262bb8783b..8ea6c3dd192f4 100644 --- a/packages/kbn-i18n/BUILD.bazel +++ b/packages/kbn-i18n/BUILD.bazel @@ -48,6 +48,7 @@ TYPES_DEPS = [ "@npm//tslib", "@npm//@types/intl-relativeformat", "@npm//@types/jest", + "@npm//@types/node", "@npm//@types/prop-types", "@npm//@types/react", "@npm//@types/react-intl", diff --git a/packages/kbn-test/src/jest/run.ts b/packages/kbn-test/src/jest/run.ts index 07610a3eb84c6..4a5dd4e9281ba 100644 --- a/packages/kbn-test/src/jest/run.ts +++ b/packages/kbn-test/src/jest/run.ts @@ -28,6 +28,20 @@ import { map } from 'lodash'; // yarn test:jest src/core/public/core_system.test.ts // :kibana/src/core/server/saved_objects yarn test:jest +// Patch node 16 types to be compatible with jest 26 +// https://github.com/facebook/jest/issues/11640#issuecomment-893867514 +/* eslint-disable */ +declare global { + namespace NodeJS { + interface Global {} + interface InspectOptions {} + + interface ConsoleConstructor + extends console.ConsoleConstructor {} + } +} +/* eslint-enable */ + export function runJest(configName = 'jest.config.js') { const argv = buildArgv(process.argv); diff --git a/src/core/server/bootstrap.ts b/src/core/server/bootstrap.ts index 5131defc93461..6190665fc78e4 100644 --- a/src/core/server/bootstrap.ts +++ b/src/core/server/bootstrap.ts @@ -51,7 +51,7 @@ export async function bootstrap({ configs, cliArgs, applyConfigOverrides }: Boot // This is only used by the LogRotator service // in order to be able to reload the log configuration // under the cluster mode - process.on('message', (msg) => { + process.on('message', (msg: any) => { if (!msg || msg.reloadConfiguration !== true) { return; } diff --git a/src/core/server/environment/environment_service.test.ts b/src/core/server/environment/environment_service.test.ts index 4b074482248b4..0817fad35f882 100644 --- a/src/core/server/environment/environment_service.test.ts +++ b/src/core/server/environment/environment_service.test.ts @@ -136,7 +136,8 @@ describe('UuidService', () => { }); }); - describe('unhandledRejection warnings', () => { + // TODO: From Nodejs v16 emitting an unhandledRejection will kill the process + describe.skip('unhandledRejection warnings', () => { it('logs warn for an unhandeld promise rejected with an Error', async () => { await service.preboot(); diff --git a/src/core/server/execution_context/integration_tests/tracing.test.ts b/src/core/server/execution_context/integration_tests/tracing.test.ts index c8dccc2ae9c42..7a54315204a6b 100644 --- a/src/core/server/execution_context/integration_tests/tracing.test.ts +++ b/src/core/server/execution_context/integration_tests/tracing.test.ts @@ -45,7 +45,7 @@ describe('trace', () => { }, }); await root.preboot(); - }, 30000); + }, 60000); afterEach(async () => { await root.shutdown(); diff --git a/src/core/server/http/http_server.test.ts b/src/core/server/http/http_server.test.ts index ffbd91c645382..8585b564090e5 100644 --- a/src/core/server/http/http_server.test.ts +++ b/src/core/server/http/http_server.test.ts @@ -7,7 +7,7 @@ */ import { Server } from 'http'; -import { rmdir, mkdtemp, readFile, writeFile } from 'fs/promises'; +import { rm, mkdtemp, readFile, writeFile } from 'fs/promises'; import supertest from 'supertest'; import { omit } from 'lodash'; import { join } from 'path'; @@ -1419,7 +1419,7 @@ describe('setup contract', () => { afterAll(async () => { if (tempDir) { - await rmdir(tempDir, { recursive: true }); + await rm(tempDir, { recursive: true }); } }); diff --git a/src/core/server/http/router/request.ts b/src/core/server/http/router/request.ts index d16158bb0fb08..89511c00a8f32 100644 --- a/src/core/server/http/router/request.ts +++ b/src/core/server/http/router/request.ts @@ -221,10 +221,8 @@ export class KibanaRequest< } private getEvents(request: Request): KibanaRequestEvents { - const finish$ = merge( - fromEvent(request.raw.res, 'finish'), // Response has been sent - fromEvent(request.raw.req, 'close') // connection was closed - ).pipe(shareReplay(1), first()); + // the response is completed, or its underlying connection was terminated prematurely + const finish$ = fromEvent(request.raw.res, 'close').pipe(shareReplay(1), first()); const aborted$ = fromEvent(request.raw.req, 'aborted').pipe(first(), takeUntil(finish$)); const completed$ = merge(finish$, aborted$).pipe(shareReplay(1), first()); diff --git a/src/core/server/http/router/validator/validator.test.ts b/src/core/server/http/router/validator/validator.test.ts index cb4fb5fd24e31..b516d723edadc 100644 --- a/src/core/server/http/router/validator/validator.test.ts +++ b/src/core/server/http/router/validator/validator.test.ts @@ -48,7 +48,7 @@ describe('Router validator', () => { expect(() => validator.getParams({})).toThrowError('[foo]: Not a string'); expect(() => validator.getParams(undefined)).toThrowError( - `Cannot read property 'foo' of undefined` + `Cannot read properties of undefined (reading 'foo')` ); expect(() => validator.getParams({}, 'myField')).toThrowError('[myField.foo]: Not a string'); diff --git a/src/core/server/logging/integration_tests/rolling_file_appender.test.ts b/src/core/server/logging/integration_tests/rolling_file_appender.test.ts index dc6a01b80e951..04b2f543d3380 100644 --- a/src/core/server/logging/integration_tests/rolling_file_appender.test.ts +++ b/src/core/server/logging/integration_tests/rolling_file_appender.test.ts @@ -7,7 +7,7 @@ */ import { join } from 'path'; -import { rmdir, mkdtemp, readFile, readdir } from 'fs/promises'; +import { rm, mkdtemp, readFile, readdir } from 'fs/promises'; import moment from 'moment-timezone'; import * as kbnTestServer from '../../../test_helpers/kbn_server'; import { getNextRollingTime } from '../appenders/rolling_file/policies/time_interval/get_next_rolling_time'; @@ -48,7 +48,7 @@ describe('RollingFileAppender', () => { afterEach(async () => { if (testDir) { - await rmdir(testDir, { recursive: true }); + await rm(testDir, { recursive: true }); } if (root) { diff --git a/src/core/server/metrics/event_loop_delays/event_loop_delays_monitor.ts b/src/core/server/metrics/event_loop_delays/event_loop_delays_monitor.ts index 3dff847f83c9b..0f3035c14a923 100644 --- a/src/core/server/metrics/event_loop_delays/event_loop_delays_monitor.ts +++ b/src/core/server/metrics/event_loop_delays/event_loop_delays_monitor.ts @@ -6,12 +6,12 @@ * Side Public License, v 1. */ -import type { EventLoopDelayMonitor } from 'perf_hooks'; +import type { IntervalHistogram as PerfIntervalHistogram } from 'perf_hooks'; import { monitorEventLoopDelay } from 'perf_hooks'; import type { IntervalHistogram } from '../types'; export class EventLoopDelaysMonitor { - private readonly loopMonitor: EventLoopDelayMonitor; + private readonly loopMonitor: PerfIntervalHistogram; private fromTimestamp: Date; /** diff --git a/src/core/server/metrics/integration_tests/server_collector.test.ts b/src/core/server/metrics/integration_tests/server_collector.test.ts index 93589648ca0ae..a16e0f2217add 100644 --- a/src/core/server/metrics/integration_tests/server_collector.test.ts +++ b/src/core/server/metrics/integration_tests/server_collector.test.ts @@ -15,6 +15,7 @@ import { HttpService, IRouter } from '../../http'; import { contextServiceMock } from '../../context/context_service.mock'; import { executionContextServiceMock } from '../../execution_context/execution_context_service.mock'; import { ServerMetricsCollector } from '../collectors/server'; +import { setTimeout as setTimeoutPromise } from 'timers/promises'; const requestWaitDelay = 25; @@ -195,6 +196,9 @@ describe('ServerMetricsCollector', () => { waitSubject.next('go'); await Promise.all([res1, res2]); + // Give the event-loop one more cycle to allow concurrent connections to be + // up to date before collecting + await setTimeoutPromise(0); metrics = await collector.collect(); expect(metrics.concurrent_connections).toEqual(0); }); diff --git a/src/core/server/status/plugins_status.ts b/src/core/server/status/plugins_status.ts index 7ef3ddb31d978..719535133e7ab 100644 --- a/src/core/server/status/plugins_status.ts +++ b/src/core/server/status/plugins_status.ts @@ -128,7 +128,7 @@ export class PluginsStatusService { return combineLatest(pluginStatuses).pipe( map((statuses) => Object.fromEntries(statuses)), - distinctUntilChanged(isDeepStrictEqual) + distinctUntilChanged>(isDeepStrictEqual) ); }) ); diff --git a/src/core/server/status/status_service.ts b/src/core/server/status/status_service.ts index a0ac5b392efe1..29cc01da3f63d 100644 --- a/src/core/server/status/status_service.ts +++ b/src/core/server/status/status_service.ts @@ -84,7 +84,7 @@ export class StatusService implements CoreService { }); return summary; }), - distinctUntilChanged(isDeepStrictEqual), + distinctUntilChanged>(isDeepStrictEqual), shareReplay(1) ); @@ -100,7 +100,7 @@ export class StatusService implements CoreService { }); return coreOverall; }), - distinctUntilChanged(isDeepStrictEqual), + distinctUntilChanged>(isDeepStrictEqual), shareReplay(1) ); @@ -186,7 +186,7 @@ export class StatusService implements CoreService { elasticsearch: elasticsearchStatus, savedObjects: savedObjectsStatus, })), - distinctUntilChanged(isDeepStrictEqual), + distinctUntilChanged(isDeepStrictEqual), shareReplay(1) ); } diff --git a/src/dev/build/tasks/patch_native_modules_task.ts b/src/dev/build/tasks/patch_native_modules_task.ts index 5a2f179edeccb..bb2b9cc96b677 100644 --- a/src/dev/build/tasks/patch_native_modules_task.ts +++ b/src/dev/build/tasks/patch_native_modules_task.ts @@ -36,12 +36,12 @@ const packages: Package[] = [ extractMethod: 'gunzip', archives: { 'darwin-x64': { - url: 'https://github.com/uhop/node-re2/releases/download/1.16.0/darwin-x64-83.gz', - sha256: 'ef49febcba972b488727ce329ea9d2b57590bb44001ed494f2aa1397c0ebc32b', + url: 'https://github.com/uhop/node-re2/releases/download/1.16.0/darwin-x64-93.gz', + sha256: 'a267c6202d86d08170eb4a833acf81d83660ce33e8981fcd5b7f6e0310961d56', }, 'linux-x64': { - url: 'https://github.com/uhop/node-re2/releases/download/1.16.0/linux-x64-83.gz', - sha256: '160217dd83eb7093b758e905ce09cb45182864c7df858bf2525a68924a23c509', + url: 'https://github.com/uhop/node-re2/releases/download/1.16.0/linux-x64-93.gz', + sha256: 'e0ca5d6527fe7ec0fe98b6960c47b66a5bb2823c3bebb3bf4ed4d58eed3d23c5', }, // ARM build is currently done manually as Github Actions used in upstream project @@ -55,12 +55,12 @@ const packages: Package[] = [ // * gzip -c build/Release/re2.node > linux-arm64-83.gz // * upload to kibana-ci-proxy-cache bucket 'linux-arm64': { - url: 'https://storage.googleapis.com/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.16.0/linux-arm64-83.gz', - sha256: '114505c60dbf57ad30556937ac5f49213c6676ad79d92706b96949d3a63f53b4', + url: 'https://storage.googleapis.com/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.16.0/linux-arm64-93.gz', + sha256: '7a786e0b75985e5aafdefa9af55cad8e85e69a3326f16d8c63d21d6b5b3bff1b', }, 'win32-x64': { - url: 'https://github.com/uhop/node-re2/releases/download/1.16.0/win32-x64-83.gz', - sha256: '92ad420a6bfcedeb58dadf807a2f2901b05251d1edd3950051699929eda23073', + url: 'https://github.com/uhop/node-re2/releases/download/1.16.0/win32-x64-93.gz', + sha256: '37245ceb59a086b5e7e9de8746a3cdf148c383be9ae2580f92baea90d0d39947', }, }, }, diff --git a/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.test.tsx b/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.test.tsx index 991033b9a0d6a..52f04bcead665 100644 --- a/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.test.tsx +++ b/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.test.tsx @@ -95,7 +95,8 @@ afterAll(() => { sizeMe.noPlaceholders = false; }); -test('renders DashboardGrid', () => { +// unhandled promise rejection: https://github.com/elastic/kibana/issues/112699 +test.skip('renders DashboardGrid', () => { const { props, options } = prepare(); const component = mountWithIntl( @@ -108,7 +109,8 @@ test('renders DashboardGrid', () => { expect(panelElements.length).toBe(2); }); -test('renders DashboardGrid with no visualizations', () => { +// unhandled promise rejection: https://github.com/elastic/kibana/issues/112699 +test.skip('renders DashboardGrid with no visualizations', () => { const { props, options } = prepare(); const component = mountWithIntl( @@ -123,7 +125,8 @@ test('renders DashboardGrid with no visualizations', () => { expect(component.find('EmbeddableChildPanel').length).toBe(0); }); -test('DashboardGrid removes panel when removed from container', () => { +// unhandled promise rejection: https://github.com/elastic/kibana/issues/112699 +test.skip('DashboardGrid removes panel when removed from container', () => { const { props, options } = prepare(); const component = mountWithIntl( @@ -142,7 +145,8 @@ test('DashboardGrid removes panel when removed from container', () => { expect(panelElements.length).toBe(1); }); -test('DashboardGrid renders expanded panel', () => { +// unhandled promise rejection: https://github.com/elastic/kibana/issues/112699 +test.skip('DashboardGrid renders expanded panel', () => { const { props, options } = prepare(); const component = mountWithIntl( @@ -170,7 +174,8 @@ test('DashboardGrid renders expanded panel', () => { ).toBeUndefined(); }); -test('DashboardGrid unmount unsubscribes', async (done) => { +// unhandled promise rejection: https://github.com/elastic/kibana/issues/112699 +test.skip('DashboardGrid unmount unsubscribes', async (done) => { const { props, options } = prepare(); const component = mountWithIntl( diff --git a/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx b/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx index 4397705691314..7a920685bcaae 100644 --- a/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx +++ b/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx @@ -92,8 +92,8 @@ function getProps(props?: Partial): { options, }; } - -test('renders DashboardViewport', () => { +// unhandled promise rejection: https://github.com/elastic/kibana/issues/112699 +test.skip('renders DashboardViewport', () => { const { props, options } = getProps(); const component = mount( @@ -108,7 +108,8 @@ test('renders DashboardViewport', () => { expect(panels.length).toBe(2); }); -test('renders DashboardViewport with no visualizations', () => { +// unhandled promise rejection: https://github.com/elastic/kibana/issues/112699 +test.skip('renders DashboardViewport with no visualizations', () => { const { props, options } = getProps(); props.container.updateInput({ panels: {} }); const component = mount( @@ -126,7 +127,8 @@ test('renders DashboardViewport with no visualizations', () => { component.unmount(); }); -test('renders DashboardEmptyScreen', () => { +// unhandled promise rejection: https://github.com/elastic/kibana/issues/112699 +test.skip('renders DashboardEmptyScreen', () => { const { props, options } = getProps(); props.container.updateInput({ panels: {} }); const component = mount( @@ -144,7 +146,8 @@ test('renders DashboardEmptyScreen', () => { component.unmount(); }); -test('renders exit full screen button when in full screen mode', async () => { +// unhandled promise rejection: https://github.com/elastic/kibana/issues/112699 +test.skip('renders exit full screen button when in full screen mode', async () => { const { props, options } = getProps(); props.container.updateInput({ isFullScreenMode: true }); const component = mount( @@ -172,7 +175,8 @@ test('renders exit full screen button when in full screen mode', async () => { component.unmount(); }); -test('renders exit full screen button when in full screen mode and empty screen', async () => { +// unhandled promise rejection: https://github.com/elastic/kibana/issues/112699 +test.skip('renders exit full screen button when in full screen mode and empty screen', async () => { const { props, options } = getProps(); props.container.updateInput({ panels: {}, isFullScreenMode: true }); const component = mount( @@ -199,7 +203,8 @@ test('renders exit full screen button when in full screen mode and empty screen' component.unmount(); }); -test('DashboardViewport unmount unsubscribes', async (done) => { +// unhandled promise rejection: https://github.com/elastic/kibana/issues/112699 +test.skip('DashboardViewport unmount unsubscribes', async (done) => { const { props, options } = getProps(); const component = mount( diff --git a/src/plugins/discover/public/application/embeddable/view_saved_search_action.test.ts b/src/plugins/discover/public/application/embeddable/view_saved_search_action.test.ts index 5796dacaa83d8..990be8927766a 100644 --- a/src/plugins/discover/public/application/embeddable/view_saved_search_action.test.ts +++ b/src/plugins/discover/public/application/embeddable/view_saved_search_action.test.ts @@ -11,11 +11,14 @@ import { ContactCardEmbeddable } from 'src/plugins/embeddable/public/lib/test_sa import { ViewSavedSearchAction } from './view_saved_search_action'; import { SavedSearchEmbeddable } from './saved_search_embeddable'; import { createStartContractMock } from '../../__mocks__/start_contract'; +import { uiSettingsServiceMock } from '../../../../../core/public/mocks'; import { savedSearchMock } from '../../__mocks__/saved_search'; import { discoverServiceMock } from '../../__mocks__/services'; import { IndexPattern } from 'src/plugins/data/common'; import { createFilterManagerMock } from 'src/plugins/data/public/query/filter_manager/filter_manager.mock'; import { ViewMode } from 'src/plugins/embeddable/public'; +import { setServices } from '../../kibana_services'; +import type { DiscoverServices } from '../../build_services'; const applicationMock = createStartContractMock(); const savedSearch = savedSearchMock; @@ -45,6 +48,11 @@ const embeddableConfig = { }; describe('view saved search action', () => { + beforeEach(() => { + setServices({ + uiSettings: uiSettingsServiceMock.createStartContract(), + } as unknown as DiscoverServices); + }); it('is compatible when embeddable is of type saved search, in view mode && appropriate permissions are set', async () => { const action = new ViewSavedSearchAction(applicationMock); const embeddable = new SavedSearchEmbeddable( diff --git a/src/plugins/telemetry/public/services/telemetry_sender.test.ts b/src/plugins/telemetry/public/services/telemetry_sender.test.ts index 6459f15fc60f7..50738b11e508d 100644 --- a/src/plugins/telemetry/public/services/telemetry_sender.test.ts +++ b/src/plugins/telemetry/public/services/telemetry_sender.test.ts @@ -260,22 +260,15 @@ describe('TelemetrySender', () => { }); }); describe('startChecking', () => { - let originalSetInterval: typeof window['setInterval']; - let mockSetInterval: jest.Mock; - - beforeAll(() => { - originalSetInterval = window.setInterval; - }); - - beforeEach(() => (window.setInterval = mockSetInterval = jest.fn())); - afterAll(() => (window.setInterval = originalSetInterval)); + beforeEach(() => jest.useFakeTimers()); + afterAll(() => jest.useRealTimers()); it('calls sendIfDue every 60000 ms', () => { const telemetryService = mockTelemetryService(); const telemetrySender = new TelemetrySender(telemetryService); telemetrySender.startChecking(); - expect(mockSetInterval).toBeCalledTimes(1); - expect(mockSetInterval).toBeCalledWith(telemetrySender['sendIfDue'], 60000); + expect(setInterval).toBeCalledTimes(1); + expect(setInterval).toBeCalledWith(telemetrySender['sendIfDue'], 60000); }); }); }); diff --git a/src/plugins/visualizations/server/migrations/visualization_saved_object_migrations.test.ts b/src/plugins/visualizations/server/migrations/visualization_saved_object_migrations.test.ts index 1ef9018f3472b..1f6fbfeb47e59 100644 --- a/src/plugins/visualizations/server/migrations/visualization_saved_object_migrations.test.ts +++ b/src/plugins/visualizations/server/migrations/visualization_saved_object_migrations.test.ts @@ -981,7 +981,7 @@ describe('migration visualization', () => { `); expect(logMsgArr).toMatchInlineSnapshot(` Array [ - "Exception @ migrateGaugeVerticalSplitToAlignment! TypeError: Cannot read property 'gauge' of undefined", + "Exception @ migrateGaugeVerticalSplitToAlignment! TypeError: Cannot read properties of undefined (reading 'gauge')", "Exception @ migrateGaugeVerticalSplitToAlignment! Payload: {\\"type\\":\\"gauge\\"}", ] `); diff --git a/src/setup_node_env/exit_on_warning.js b/src/setup_node_env/exit_on_warning.js index e9c96f2c49bb4..998dd02a6bff0 100644 --- a/src/setup_node_env/exit_on_warning.js +++ b/src/setup_node_env/exit_on_warning.js @@ -29,6 +29,22 @@ var IGNORE_WARNINGS = [ file: '/node_modules/supertest/node_modules/superagent/lib/node/index.js', line: 418, }, + // TODO @elastic/es-clients + // 'Use of deprecated folder mapping "./" in the "exports" field module resolution of the package + // at node_modules/@elastic/elasticsearch/package.json.' + // This is a breaking change in Node 12, which elasticsearch-js supports. + // https://github.com/elastic/elasticsearch-js/issues/1465 + // https://nodejs.org/api/deprecations.html#DEP0148 + { + name: 'DeprecationWarning', + code: 'DEP0148', + }, + // In future versions of Node.js, fs.rmdir(path, { recursive: true }) will be removed. + // Remove after https://github.com/elastic/synthetics/pull/390 + { + name: 'DeprecationWarning', + code: 'DEP0147', + }, { // TODO: @elastic/es-clients - The new client will attempt a Product check and it will `process.emitWarning` // that the security features are blocking such check. diff --git a/x-pack/plugins/apm/ftr_e2e/cypress/tasks/es_archiver.ts b/x-pack/plugins/apm/ftr_e2e/cypress/tasks/es_archiver.ts index 5e4dd9f8657ff..a2ff99c5c377e 100644 --- a/x-pack/plugins/apm/ftr_e2e/cypress/tasks/es_archiver.ts +++ b/x-pack/plugins/apm/ftr_e2e/cypress/tasks/es_archiver.ts @@ -17,7 +17,7 @@ export const esArchiverLoad = (folder: string) => { const path = Path.join(ES_ARCHIVE_DIR, folder); execSync( `node ../../../../scripts/es_archiver load "${path}" --config ../../../test/functional/config.js`, - { env: { ...process.env, NODE_TLS_REJECT_UNAUTHORIZED } } + { env: { ...process.env, NODE_TLS_REJECT_UNAUTHORIZED }, stdio: 'inherit' } ); }; @@ -25,13 +25,13 @@ export const esArchiverUnload = (folder: string) => { const path = Path.join(ES_ARCHIVE_DIR, folder); execSync( `node ../../../../scripts/es_archiver unload "${path}" --config ../../../test/functional/config.js`, - { env: { ...process.env, NODE_TLS_REJECT_UNAUTHORIZED } } + { env: { ...process.env, NODE_TLS_REJECT_UNAUTHORIZED }, stdio: 'inherit' } ); }; export const esArchiverResetKibana = () => { execSync( `node ../../../../scripts/es_archiver empty-kibana-index --config ../../../test/functional/config.js`, - { env: { ...process.env, NODE_TLS_REJECT_UNAUTHORIZED } } + { env: { ...process.env, NODE_TLS_REJECT_UNAUTHORIZED }, stdio: 'inherit' } ); }; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_logic.test.ts index cf1b45d468260..753871765896a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_logic.test.ts @@ -493,7 +493,7 @@ describe('DocumentCreationLogic', () => { await nextTick(); expect(DocumentCreationLogic.actions.setErrors).toHaveBeenCalledWith( - "Cannot read property 'total' of undefined" + "Cannot read properties of undefined (reading 'total')" ); }); diff --git a/x-pack/plugins/fleet/server/services/epm/registry/requests.ts b/x-pack/plugins/fleet/server/services/epm/registry/requests.ts index 40943aa0cffff..ed6df5f6459ec 100644 --- a/x-pack/plugins/fleet/server/services/epm/registry/requests.ts +++ b/x-pack/plugins/fleet/server/services/epm/registry/requests.ts @@ -97,7 +97,6 @@ export function getFetchOptions(targetUrl: string): RequestInit | undefined { logger.debug(`Using ${proxyUrl} as proxy for ${targetUrl}`); return { - // @ts-expect-error The types exposed by 'HttpsProxyAgent' isn't up to date with 'Agent' agent: getProxyAgent({ proxyUrl, targetUrl }), }; } diff --git a/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.test.ts b/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.test.ts index ae6089d8020fc..e23c1a59eb135 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.test.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.test.ts @@ -22,7 +22,8 @@ import { stubWebWorker } from '@kbn/test/jest'; import { createMemoryHistory } from 'history'; stubWebWorker(); -describe('', () => { +// unhandled promise rejection https://github.com/elastic/kibana/issues/112699 +describe.skip('', () => { const { server, httpRequestsMockHelpers } = setupEnvironment(); let testBed: IndicesTestBed; diff --git a/x-pack/plugins/reporting/server/export_types/common/decrypt_job_headers.test.ts b/x-pack/plugins/reporting/server/export_types/common/decrypt_job_headers.test.ts index 4303de6a3ef56..b5258d91485f7 100644 --- a/x-pack/plugins/reporting/server/export_types/common/decrypt_job_headers.test.ts +++ b/x-pack/plugins/reporting/server/export_types/common/decrypt_job_headers.test.ts @@ -25,7 +25,7 @@ describe('headers', () => { logger ); await expect(getDecryptedHeaders()).rejects.toMatchInlineSnapshot( - `[Error: Failed to decrypt report job data. Please ensure that xpack.reporting.encryptionKey is set and re-generate this report. Error: Invalid IV length]` + `[Error: Failed to decrypt report job data. Please ensure that xpack.reporting.encryptionKey is set and re-generate this report. TypeError: Invalid initialization vector]` ); }); diff --git a/x-pack/plugins/reporting/server/export_types/csv/execute_job.test.ts b/x-pack/plugins/reporting/server/export_types/csv/execute_job.test.ts index e5d0ed2613719..cb103812c7f2a 100644 --- a/x-pack/plugins/reporting/server/export_types/csv/execute_job.test.ts +++ b/x-pack/plugins/reporting/server/export_types/csv/execute_job.test.ts @@ -302,7 +302,9 @@ describe('CSV Execute Job', function () { }); await expect( runTask('job123', jobParams, cancellationToken, stream) - ).rejects.toMatchInlineSnapshot(`[TypeError: Cannot read property 'indexOf' of undefined]`); + ).rejects.toMatchInlineSnapshot( + `[TypeError: Cannot read properties of undefined (reading 'indexOf')]` + ); expect(mockEsClient.clearScroll).toHaveBeenCalledWith( expect.objectContaining({ body: { scroll_id: lastScrollId } }) diff --git a/x-pack/plugins/security_solution/public/common/mock/utils.ts b/x-pack/plugins/security_solution/public/common/mock/utils.ts index b1851fd055b33..0bafdc4fad1e8 100644 --- a/x-pack/plugins/security_solution/public/common/mock/utils.ts +++ b/x-pack/plugins/security_solution/public/common/mock/utils.ts @@ -21,11 +21,12 @@ import { mockGlobalState } from './global_state'; import { TimelineState } from '../../timelines/store/timeline/types'; import { defaultHeaders } from '../../timelines/components/timeline/body/column_headers/default_headers'; -interface Global extends NodeJS.Global { +type GlobalThis = typeof globalThis; +interface Global extends GlobalThis { // eslint-disable-next-line @typescript-eslint/no-explicit-any - window?: any; + window: any; // eslint-disable-next-line @typescript-eslint/no-explicit-any - document?: any; + document: any; } export const globalNode: Global = global; diff --git a/x-pack/plugins/security_solution/public/management/components/search_exceptions/search_exceptions.test.tsx b/x-pack/plugins/security_solution/public/management/components/search_exceptions/search_exceptions.test.tsx index 084978d35d03a..d7db249475df7 100644 --- a/x-pack/plugins/security_solution/public/management/components/search_exceptions/search_exceptions.test.tsx +++ b/x-pack/plugins/security_solution/public/management/components/search_exceptions/search_exceptions.test.tsx @@ -20,6 +20,7 @@ jest.mock('../../../common/components/user_privileges/use_endpoint_privileges'); let onSearchMock: jest.Mock; const mockUseEndpointPrivileges = useEndpointPrivileges as jest.Mock; +// unhandled promise rejection: https://github.com/elastic/kibana/issues/112699 describe('Search exceptions', () => { let appTestContext: AppContextTestRender; let renderResult: ReturnType; diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.test.ts b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.test.ts index 15d0684a2864b..43fa4e104067f 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.test.ts +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.test.ts @@ -61,7 +61,8 @@ jest.mock('../../../../common/lib/kibana'); type EndpointListStore = Store, Immutable>; -describe('endpoint list middleware', () => { +// unhandled promise rejection: https://github.com/elastic/kibana/issues/112699 +describe.skip('endpoint list middleware', () => { const getKibanaServicesMock = KibanaServices.get as jest.Mock; let fakeCoreStart: jest.Mocked; let depsStart: DepsStartMock; diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/layout/policy_trusted_apps_layout.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/layout/policy_trusted_apps_layout.test.tsx index 8ae0d9d45c236..d46775d38834b 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/layout/policy_trusted_apps_layout.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/layout/policy_trusted_apps_layout.test.tsx @@ -42,7 +42,8 @@ let coreStart: AppContextTestRender['coreStart']; let http: typeof coreStart.http; const generator = new EndpointDocGenerator(); -describe('Policy trusted apps layout', () => { +// unhandled promise rejection: https://github.com/elastic/kibana/issues/112699 +describe.skip('Policy trusted apps layout', () => { beforeEach(() => { mockedContext = createAppRootMockRenderer(); http = mockedContext.coreStart.http; diff --git a/x-pack/plugins/stack_alerts/server/plugin.test.ts b/x-pack/plugins/stack_alerts/server/plugin.test.ts index b9263553173d2..b2bf076eaf49d 100644 --- a/x-pack/plugins/stack_alerts/server/plugin.test.ts +++ b/x-pack/plugins/stack_alerts/server/plugin.test.ts @@ -11,7 +11,8 @@ import { alertsMock } from '../../alerting/server/mocks'; import { featuresPluginMock } from '../../features/server/mocks'; import { BUILT_IN_ALERTS_FEATURE } from './feature'; -describe('AlertingBuiltins Plugin', () => { +// unhandled promise rejection: https://github.com/elastic/kibana/issues/112699 +describe.skip('AlertingBuiltins Plugin', () => { describe('setup()', () => { let context: ReturnType; let plugin: AlertingBuiltinsPlugin; diff --git a/x-pack/plugins/uptime/e2e/tasks/es_archiver.ts b/x-pack/plugins/uptime/e2e/tasks/es_archiver.ts index ce82be18dff7f..dac5672bdf649 100644 --- a/x-pack/plugins/uptime/e2e/tasks/es_archiver.ts +++ b/x-pack/plugins/uptime/e2e/tasks/es_archiver.ts @@ -17,7 +17,7 @@ export const esArchiverLoad = (folder: string) => { const path = Path.join(ES_ARCHIVE_DIR, folder); execSync( `node ../../../../scripts/es_archiver load "${path}" --config ../../../test/functional/config.js`, - { env: { ...process.env, NODE_TLS_REJECT_UNAUTHORIZED } } + { env: { ...process.env, NODE_TLS_REJECT_UNAUTHORIZED }, stdio: 'inherit' } ); }; @@ -25,13 +25,13 @@ export const esArchiverUnload = (folder: string) => { const path = Path.join(ES_ARCHIVE_DIR, folder); execSync( `node ../../../../scripts/es_archiver unload "${path}" --config ../../../test/functional/config.js`, - { env: { ...process.env, NODE_TLS_REJECT_UNAUTHORIZED } } + { env: { ...process.env, NODE_TLS_REJECT_UNAUTHORIZED }, stdio: 'inherit' } ); }; export const esArchiverResetKibana = () => { execSync( `node ../../../../scripts/es_archiver empty-kibana-index --config ../../../test/functional/config.js`, - { env: { ...process.env, NODE_TLS_REJECT_UNAUTHORIZED } } + { env: { ...process.env, NODE_TLS_REJECT_UNAUTHORIZED }, stdio: 'inherit' } ); }; diff --git a/x-pack/plugins/uptime/public/components/fleet_package/custom_fields.test.tsx b/x-pack/plugins/uptime/public/components/fleet_package/custom_fields.test.tsx index f16e72837b343..26ee26cc8ed7f 100644 --- a/x-pack/plugins/uptime/public/components/fleet_package/custom_fields.test.tsx +++ b/x-pack/plugins/uptime/public/components/fleet_package/custom_fields.test.tsx @@ -50,7 +50,8 @@ const defaultValidation = centralValidation[DataStream.HTTP]; const defaultHTTPConfig = defaultConfig[DataStream.HTTP]; const defaultTCPConfig = defaultConfig[DataStream.TCP]; -describe('', () => { +// unhandled promise rejection: https://github.com/elastic/kibana/issues/112699 +describe.skip('', () => { const WrappedComponent = ({ validate = defaultValidation, typeEditable = false, diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.test.tsx index d044ad4e6a3a2..240697af470b0 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.test.tsx @@ -5,7 +5,6 @@ * 2.0. */ -import 'jest'; import React from 'react'; import { MonitorListDrawerComponent } from './monitor_list_drawer'; import { MonitorDetails, MonitorSummary, makePing } from '../../../../../common/runtime_types'; diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/jira.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/jira.ts index 7d69e80dae584..7e8272b0a8afa 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/jira.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/jira.ts @@ -232,31 +232,8 @@ export default function jiraTest({ getService }: FtrProviderContext) { expect(resp.body.connector_id).to.eql(simulatedActionId); expect(resp.body.status).to.eql('error'); expect(resp.body.retry).to.eql(false); - // Node.js 12 oddity: - // - // The first time after the server is booted, the error message will be: - // - // undefined is not iterable (cannot read property Symbol(Symbol.iterator)) - // - // After this, the error will be: - // - // Cannot destructure property 'value' of 'undefined' as it is undefined. - // - // The error seems to come from the exact same place in the code based on the - // exact same circomstances: - // - // https://github.com/elastic/kibana/blob/b0a223ebcbac7e404e8ae6da23b2cc6a4b509ff1/packages/kbn-config-schema/src/types/literal_type.ts#L28 - // - // What triggers the error is that the `handleError` function expects its 2nd - // argument to be an object containing a `valids` property of type array. - // - // In this test the object does not contain a `valids` property, so hence the - // error. - // - // Why the error message isn't the same in all scenarios is unknown to me and - // could be a bug in V8. - expect(resp.body.message).to.match( - /^error validating action params: (undefined is not iterable \(cannot read property Symbol\(Symbol.iterator\)\)|Cannot destructure property 'value' of 'undefined' as it is undefined\.)$/ + expect(resp.body.message).to.be( + `error validating action params: Cannot destructure property 'Symbol(Symbol.iterator)' of 'undefined' as it is undefined.` ); }); }); diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/resilient.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/resilient.ts index 00989b35fd4e2..4421c984b4aed 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/resilient.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/resilient.ts @@ -234,31 +234,8 @@ export default function resilientTest({ getService }: FtrProviderContext) { expect(resp.body.connector_id).to.eql(simulatedActionId); expect(resp.body.status).to.eql('error'); expect(resp.body.retry).to.eql(false); - // Node.js 12 oddity: - // - // The first time after the server is booted, the error message will be: - // - // undefined is not iterable (cannot read property Symbol(Symbol.iterator)) - // - // After this, the error will be: - // - // Cannot destructure property 'value' of 'undefined' as it is undefined. - // - // The error seems to come from the exact same place in the code based on the - // exact same circomstances: - // - // https://github.com/elastic/kibana/blob/b0a223ebcbac7e404e8ae6da23b2cc6a4b509ff1/packages/kbn-config-schema/src/types/literal_type.ts#L28 - // - // What triggers the error is that the `handleError` function expects its 2nd - // argument to be an object containing a `valids` property of type array. - // - // In this test the object does not contain a `valids` property, so hence the - // error. - // - // Why the error message isn't the same in all scenarios is unknown to me and - // could be a bug in V8. - expect(resp.body.message).to.match( - /^error validating action params: (undefined is not iterable \(cannot read property Symbol\(Symbol.iterator\)\)|Cannot destructure property 'value' of 'undefined' as it is undefined\.)$/ + expect(resp.body.message).to.be( + `error validating action params: Cannot destructure property 'Symbol(Symbol.iterator)' of 'undefined' as it is undefined.` ); }); }); diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/servicenow_itsm.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/servicenow_itsm.ts index fe1ebdf8d28a9..5ff1663975145 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/servicenow_itsm.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/servicenow_itsm.ts @@ -242,31 +242,8 @@ export default function serviceNowITSMTest({ getService }: FtrProviderContext) { expect(resp.body.connector_id).to.eql(simulatedActionId); expect(resp.body.status).to.eql('error'); expect(resp.body.retry).to.eql(false); - // Node.js 12 oddity: - // - // The first time after the server is booted, the error message will be: - // - // undefined is not iterable (cannot read property Symbol(Symbol.iterator)) - // - // After this, the error will be: - // - // Cannot destructure property 'value' of 'undefined' as it is undefined. - // - // The error seems to come from the exact same place in the code based on the - // exact same circumstances: - // - // https://github.com/elastic/kibana/blob/b0a223ebcbac7e404e8ae6da23b2cc6a4b509ff1/packages/kbn-config-schema/src/types/literal_type.ts#L28 - // - // What triggers the error is that the `handleError` function expects its 2nd - // argument to be an object containing a `valids` property of type array. - // - // In this test the object does not contain a `valids` property, so hence the - // error. - // - // Why the error message isn't the same in all scenarios is unknown to me and - // could be a bug in V8. - expect(resp.body.message).to.match( - /^error validating action params: (undefined is not iterable \(cannot read property Symbol\(Symbol.iterator\)\)|Cannot destructure property 'value' of 'undefined' as it is undefined\.)$/ + expect(resp.body.message).to.be( + `error validating action params: Cannot destructure property 'Symbol(Symbol.iterator)' of 'undefined' as it is undefined.` ); }); }); diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/servicenow_sir.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/servicenow_sir.ts index eee3425b6a61f..bc4ec43fb4c7b 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/servicenow_sir.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/servicenow_sir.ts @@ -246,31 +246,8 @@ export default function serviceNowSIRTest({ getService }: FtrProviderContext) { expect(resp.body.connector_id).to.eql(simulatedActionId); expect(resp.body.status).to.eql('error'); expect(resp.body.retry).to.eql(false); - // Node.js 12 oddity: - // - // The first time after the server is booted, the error message will be: - // - // undefined is not iterable (cannot read property Symbol(Symbol.iterator)) - // - // After this, the error will be: - // - // Cannot destructure property 'value' of 'undefined' as it is undefined. - // - // The error seems to come from the exact same place in the code based on the - // exact same circumstances: - // - // https://github.com/elastic/kibana/blob/b0a223ebcbac7e404e8ae6da23b2cc6a4b509ff1/packages/kbn-config-schema/src/types/literal_type.ts#L28 - // - // What triggers the error is that the `handleError` function expects its 2nd - // argument to be an object containing a `valids` property of type array. - // - // In this test the object does not contain a `valids` property, so hence the - // error. - // - // Why the error message isn't the same in all scenarios is unknown to me and - // could be a bug in V8. - expect(resp.body.message).to.match( - /^error validating action params: (undefined is not iterable \(cannot read property Symbol\(Symbol.iterator\)\)|Cannot destructure property 'value' of 'undefined' as it is undefined\.)$/ + expect(resp.body.message).to.be( + `error validating action params: Cannot destructure property 'Symbol(Symbol.iterator)' of 'undefined' as it is undefined.` ); }); }); diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/swimlane.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/swimlane.ts index eae630593b4df..93d3a6c9e003f 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/swimlane.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/swimlane.ts @@ -323,31 +323,8 @@ export default function swimlaneTest({ getService }: FtrProviderContext) { expect(resp.body.connector_id).to.eql(simulatedActionId); expect(resp.body.status).to.eql('error'); expect(resp.body.retry).to.eql(false); - // Node.js 12 oddity: - // - // The first time after the server is booted, the error message will be: - // - // undefined is not iterable (cannot read property Symbol(Symbol.iterator)) - // - // After this, the error will be: - // - // Cannot destructure property 'value' of 'undefined' as it is undefined. - // - // The error seems to come from the exact same place in the code based on the - // exact same circomstances: - // - // https://github.com/elastic/kibana/blob/b0a223ebcbac7e404e8ae6da23b2cc6a4b509ff1/packages/kbn-config-schema/src/types/literal_type.ts#L28 - // - // What triggers the error is that the `handleError` function expects its 2nd - // argument to be an object containing a `valids` property of type array. - // - // In this test the object does not contain a `valids` property, so hence the - // error. - // - // Why the error message isn't the same in all scenarios is unknown to me and - // could be a bug in V8. - expect(resp.body.message).to.match( - /^error validating action params: (undefined is not iterable \(cannot read property Symbol\(Symbol.iterator\)\)|Cannot destructure property 'value' of 'undefined' as it is undefined\.)$/ + expect(resp.body.message).to.be( + `error validating action params: undefined is not iterable (cannot read property Symbol(Symbol.iterator))` ); }); }); diff --git a/yarn.lock b/yarn.lock index f0e1921b77441..9cba714293ff9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6582,10 +6582,10 @@ resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-8.2.0.tgz#3eb56d13a1de1d347ecb1957c6860c911704bc44" integrity sha512-/Sge3BymXo4lKc31C8OINJgXLaw+7vL1/L1pGiBNpGrBiT8FQiaFpSYV0uhTaG4y78vcMBTMFsWaHDvuD+xGzQ== -"@types/mock-fs@^4.10.0": - version "4.10.0" - resolved "https://registry.yarnpkg.com/@types/mock-fs/-/mock-fs-4.10.0.tgz#460061b186993d76856f669d5317cda8a007c24b" - integrity sha512-FQ5alSzmHMmliqcL36JqIA4Yyn9jyJKvRSGV3mvPh108VFatX7naJDzSG4fnFQNZFq9dIx0Dzoe6ddflMB2Xkg== +"@types/mock-fs@^4.13.1": + version "4.13.1" + resolved "https://registry.yarnpkg.com/@types/mock-fs/-/mock-fs-4.13.1.tgz#9201554ceb23671badbfa8ac3f1fa9e0706305be" + integrity sha512-m6nFAJ3lBSnqbvDZioawRvpLXSaPyn52Srf7OfzjubYbYX8MTUdIgDxQl0wEapm4m/pNYSd9TXocpQ0TvZFlYA== dependencies: "@types/node" "*" @@ -6637,10 +6637,10 @@ dependencies: "@types/node" "*" -"@types/node@*", "@types/node@14.14.44", "@types/node@8.10.54", "@types/node@>= 8", "@types/node@>=8.9.0", "@types/node@^10.1.0", "@types/node@^14.14.31": - version "14.14.44" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.44.tgz#df7503e6002847b834371c004b372529f3f85215" - integrity sha512-+gaugz6Oce6ZInfI/tK4Pq5wIIkJMEJUu92RB3Eu93mtj4wjjjz9EB5mLp5s1pSsLXdC/CPut/xF20ZzAQJbTA== +"@types/node@*", "@types/node@16.10.2", "@types/node@8.10.54", "@types/node@>= 8", "@types/node@>=8.9.0", "@types/node@^10.1.0", "@types/node@^14.14.31": + version "16.10.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-16.10.2.tgz#5764ca9aa94470adb4e1185fe2e9f19458992b2e" + integrity sha512-zCclL4/rx+W5SQTzFs9wyvvyCwoK9QtBpratqz2IYJ3O8Umrn0m3nsTv0wQBk9sRGpvUe9CwPDrQFB10f1FIjQ== "@types/nodemailer@^6.4.0": version "6.4.0" @@ -7708,14 +7708,7 @@ agent-base@5: resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-5.1.1.tgz#e8fb3f242959db44d63be665db7a8e739537a32c" integrity sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g== -agent-base@6: - version "6.0.0" - resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.0.tgz#5d0101f19bbfaed39980b22ae866de153b93f09a" - integrity sha512-j1Q7cSCqN+AwrmDd+pzgqc0/NpC655x2bUf5ZjRIO77DcNBFmh+OgRNzF6OKdCC9RSCb19fGd99+bhXFdkRNqw== - dependencies: - debug "4" - -agent-base@^6.0.2: +agent-base@6, agent-base@^6.0.2: version "6.0.2" resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== @@ -20576,10 +20569,10 @@ mochawesome@^6.2.1: strip-ansi "^6.0.0" uuid "^7.0.3" -mock-fs@^4.12.0: - version "4.12.0" - resolved "https://registry.yarnpkg.com/mock-fs/-/mock-fs-4.12.0.tgz#a5d50b12d2d75e5bec9dac3b67ffe3c41d31ade4" - integrity sha512-/P/HtrlvBxY4o/PzXY9cCNBrdylDNxg7gnrv2sMNxj+UJ2m8jSpl0/A6fuJeNAWr99ZvGWH8XCbE0vmnM5KupQ== +mock-fs@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/mock-fs/-/mock-fs-5.1.1.tgz#d4c95e916abf400664197079d7e399d133bb6048" + integrity sha512-p/8oZ3qvfKGPw+4wdVCyjDxa6wn2tP0TCf3WXC1UyUBAevezPn1TtOoxtMYVbZu/S/iExg+Ghed1busItj2CEw== mock-http-server@1.3.0: version "1.3.0" From 845bcf85c1555c9a2f599992efd0f6b509035b98 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Sat, 16 Oct 2021 20:43:07 -0500 Subject: [PATCH 3/5] skip flaky test. #113892 --- .../artifact_entry_card/artifact_entry_card.test.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/security_solution/public/management/components/artifact_entry_card/artifact_entry_card.test.tsx b/x-pack/plugins/security_solution/public/management/components/artifact_entry_card/artifact_entry_card.test.tsx index bde1961dd782d..50500a789fd4e 100644 --- a/x-pack/plugins/security_solution/public/management/components/artifact_entry_card/artifact_entry_card.test.tsx +++ b/x-pack/plugins/security_solution/public/management/components/artifact_entry_card/artifact_entry_card.test.tsx @@ -63,7 +63,8 @@ describe.each([ ); }); - it('should display dates in expected format', () => { + // FLAKY https://github.com/elastic/kibana/issues/113892 + it.skip('should display dates in expected format', () => { render(); expect(renderResult.getByTestId('testCard-header-updated').textContent).toEqual( From 06e66ca284483866232a551faf1c007a5f49bba8 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Sat, 16 Oct 2021 22:32:21 -0500 Subject: [PATCH 4/5] skip flaky tests. #89052, #113418, #115304 --- .../tests/exception_operators_data_types/ip_array.ts | 3 ++- .../tests/exception_operators_data_types/keyword_array.ts | 3 ++- .../tests/exception_operators_data_types/text_array.ts | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/exception_operators_data_types/ip_array.ts b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/exception_operators_data_types/ip_array.ts index 9c169c1c34207..d5e9050ed9d41 100644 --- a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/exception_operators_data_types/ip_array.ts +++ b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/exception_operators_data_types/ip_array.ts @@ -486,7 +486,8 @@ export default ({ getService }: FtrProviderContext) => { expect(ips).to.eql([[], ['127.0.0.8', '127.0.0.9', '127.0.0.10']]); }); - it('will return 1 result if we have a list that includes all ips', async () => { + // FLAKY https://github.com/elastic/kibana/issues/89052 + it.skip('will return 1 result if we have a list that includes all ips', async () => { await importFile( supertest, 'ip', diff --git a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/exception_operators_data_types/keyword_array.ts b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/exception_operators_data_types/keyword_array.ts index 2a2c8df30981f..94c8ab6f4664f 100644 --- a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/exception_operators_data_types/keyword_array.ts +++ b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/exception_operators_data_types/keyword_array.ts @@ -496,7 +496,8 @@ export default ({ getService }: FtrProviderContext) => { expect(hits).to.eql([[], ['word eight', 'word nine', 'word ten']]); }); - it('will return only the empty array for results if we have a list that includes all keyword', async () => { + // FLAKY https://github.com/elastic/kibana/issues/115304 + it.skip('will return only the empty array for results if we have a list that includes all keyword', async () => { await importFile( supertest, 'keyword', diff --git a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/exception_operators_data_types/text_array.ts b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/exception_operators_data_types/text_array.ts index b152b44867a09..2ee7ebfc18be0 100644 --- a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/exception_operators_data_types/text_array.ts +++ b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/exception_operators_data_types/text_array.ts @@ -494,7 +494,8 @@ export default ({ getService }: FtrProviderContext) => { expect(hits).to.eql([[], ['word eight', 'word nine', 'word ten']]); }); - it('will return only the empty array for results if we have a list that includes all text', async () => { + // FLAKY https://github.com/elastic/kibana/issues/113418 + it.skip('will return only the empty array for results if we have a list that includes all text', async () => { await importFile( supertest, 'text', From fd3379d0692b911937fda62ccb82f1e9a7900c33 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Sun, 17 Oct 2021 09:47:08 -0500 Subject: [PATCH 5/5] skip flaky suite. #107057 --- .../apps/discover/_indexpattern_without_timefield.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/functional/apps/discover/_indexpattern_without_timefield.ts b/test/functional/apps/discover/_indexpattern_without_timefield.ts index 81fb4f92ab730..42291691f3f5f 100644 --- a/test/functional/apps/discover/_indexpattern_without_timefield.ts +++ b/test/functional/apps/discover/_indexpattern_without_timefield.ts @@ -17,7 +17,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const testSubjects = getService('testSubjects'); const PageObjects = getPageObjects(['common', 'timePicker', 'discover']); - describe('indexpattern without timefield', () => { + // FLAKY https://github.com/elastic/kibana/issues/107057 + describe.skip('indexpattern without timefield', () => { before(async () => { await security.testUser.setRoles(['kibana_admin', 'kibana_timefield']); await esArchiver.loadIfNeeded(