From 50e730a43c0330d4fbebc77987221b64706ecde0 Mon Sep 17 00:00:00 2001 From: Davis McPhee Date: Mon, 30 Sep 2024 22:00:47 -0300 Subject: [PATCH] Fix flaky test #193400 (#194346) ## Summary This PR unskips the flaky test from #193400. It wasn't clear exactly why this was flaky and I couldn't reproduce it, but I made some minor changes to the default profile app state code that could address some potential race conditions. However, both my original 100x flaky test run without the changes and my 100x flaky test run after the changes succeeded, so it's hard to tell if the tests are still flaky or if the changes actually had any impact. Flaky test runs: - https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7027 - https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7028 Resolves #193400. Resolves #193367. ### Checklist - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: Elastic Machine --- .../discover_data_state_container.ts | 36 +++++++++++-------- .../utils/change_data_view.ts | 2 +- .../_get_additional_cell_actions.ts | 3 +- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/plugins/discover/public/application/main/state_management/discover_data_state_container.ts b/src/plugins/discover/public/application/main/state_management/discover_data_state_container.ts index 344dd92eaa04d..ce7f820aa3cdd 100644 --- a/src/plugins/discover/public/application/main/state_management/discover_data_state_container.ts +++ b/src/plugins/discover/public/application/main/state_management/discover_data_state_container.ts @@ -275,25 +275,33 @@ export function getDataStateContainer({ const { resetDefaultProfileState, dataView } = internalStateContainer.getState(); const { esqlQueryColumns } = dataSubjects.documents$.getValue(); const defaultColumns = uiSettings.get(DEFAULT_COLUMNS_SETTING, []); - - if (dataView) { - const stateUpdate = getDefaultProfileState({ - profilesManager, - resetDefaultProfileState, - defaultColumns, - dataView, - esqlQueryColumns, + const clearResetProfileState = () => { + internalStateContainer.transitions.setResetDefaultProfileState({ + columns: false, + rowHeight: false, }); + }; - if (stateUpdate) { - await appStateContainer.replaceUrlState(stateUpdate); - } + if (!dataView) { + clearResetProfileState(); + return; } - internalStateContainer.transitions.setResetDefaultProfileState({ - columns: false, - rowHeight: false, + const stateUpdate = getDefaultProfileState({ + profilesManager, + resetDefaultProfileState, + defaultColumns, + dataView, + esqlQueryColumns, }); + + if (!stateUpdate) { + clearResetProfileState(); + return; + } + + await appStateContainer.replaceUrlState(stateUpdate); + clearResetProfileState(); } ); diff --git a/src/plugins/discover/public/application/main/state_management/utils/change_data_view.ts b/src/plugins/discover/public/application/main/state_management/utils/change_data_view.ts index 55738d75f785e..54885c5de9bfd 100644 --- a/src/plugins/discover/public/application/main/state_management/utils/change_data_view.ts +++ b/src/plugins/discover/public/application/main/state_management/utils/change_data_view.ts @@ -43,6 +43,7 @@ export async function changeDataView( let nextDataView: DataView | null = null; internalState.transitions.setIsDataViewLoading(true); + internalState.transitions.setResetDefaultProfileState({ columns: true, rowHeight: true }); try { nextDataView = typeof id === 'string' ? await dataViews.get(id, false) : id; @@ -70,5 +71,4 @@ export async function changeDataView( } internalState.transitions.setIsDataViewLoading(false); - internalState.transitions.setResetDefaultProfileState({ columns: true, rowHeight: true }); } diff --git a/x-pack/test_serverless/functional/test_suites/common/discover/context_awareness/extensions/_get_additional_cell_actions.ts b/x-pack/test_serverless/functional/test_suites/common/discover/context_awareness/extensions/_get_additional_cell_actions.ts index 6e84d54661901..738785357fb5e 100644 --- a/x-pack/test_serverless/functional/test_suites/common/discover/context_awareness/extensions/_get_additional_cell_actions.ts +++ b/x-pack/test_serverless/functional/test_suites/common/discover/context_awareness/extensions/_get_additional_cell_actions.ts @@ -21,8 +21,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const dataGrid = getService('dataGrid'); const browser = getService('browser'); - // Failing: See https://github.com/elastic/kibana/issues/193400 - describe.skip('extension getAdditionalCellActions', () => { + describe('extension getAdditionalCellActions', () => { before(async () => { await PageObjects.svlCommonPage.loginAsAdmin(); });