mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
# Backport This will backport the following commits from `main` to `7.17`: - [[esArchiver] Do not perform SO migration on cleanup (#163302)](https://github.com/elastic/kibana/pull/163302) <!--- Backport version: 8.9.8 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Gerard Soldevila","email":"gerard.soldevila@elastic.co"},"sourceCommit":{"committedDate":"2023-09-01T10:41:20Z","message":"[esArchiver] Do not perform SO migration on cleanup (#163302)\n\n## Summary\r\n\r\nAttempt at fixing https://github.com/elastic/kibana/issues/127545\r\n\r\nThe failing tests use `esArchiver` to cleanup Saved Object indices\r\nbetween tests.\r\nStrangely, the cleanup method calls the migration logic to update the SO\r\nindices.\r\n\r\nIn this particular source of flakiness, a test fails during the\r\nmigration (problem is tracked by\r\nhttps://github.com/elastic/kibana/issues/163289).\r\n\r\nPerforming a migration as part of the cleanup does not make too much\r\nsense (at least in this test suite), so the goal of this PR is to\r\nsimplify the cleanup operation, getting rid of the call to\r\n`migrateSavedObjectIndices`.\r\n\r\n50 runs flaky test runner\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2850\r\n✅","sha":"f8303ec7cf57aa8787331ada397dfa853de969c9","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","Team:Core","Team:Operations","release_note:skip","test-failure-flaky","backport:all-open","v8.10.0","v8.11.0"],"number":163302,"url":"https://github.com/elastic/kibana/pull/163302","mergeCommit":{"message":"[esArchiver] Do not perform SO migration on cleanup (#163302)\n\n## Summary\r\n\r\nAttempt at fixing https://github.com/elastic/kibana/issues/127545\r\n\r\nThe failing tests use `esArchiver` to cleanup Saved Object indices\r\nbetween tests.\r\nStrangely, the cleanup method calls the migration logic to update the SO\r\nindices.\r\n\r\nIn this particular source of flakiness, a test fails during the\r\nmigration (problem is tracked by\r\nhttps://github.com/elastic/kibana/issues/163289).\r\n\r\nPerforming a migration as part of the cleanup does not make too much\r\nsense (at least in this test suite), so the goal of this PR is to\r\nsimplify the cleanup operation, getting rid of the call to\r\n`migrateSavedObjectIndices`.\r\n\r\n50 runs flaky test runner\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2850\r\n✅","sha":"f8303ec7cf57aa8787331ada397dfa853de969c9"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"8.10","label":"v8.10.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/165451","number":165451,"state":"MERGED","mergeCommit":{"sha":"8ea7cee5003c3bfb550da9ab1fab8e9bfe820250","message":"[8.10] [esArchiver] Do not perform SO migration on cleanup (#163302) (#165451)\n\n# Backport\n\nThis will backport the following commits from `main` to `8.10`:\n- [[esArchiver] Do not perform SO migration on cleanup\n(#163302)](https://github.com/elastic/kibana/pull/163302)\n\n<!--- Backport version: 8.9.7 -->\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sqren/backport)\n\n<!--BACKPORT [{\"author\":{\"name\":\"Gerard\nSoldevila\",\"email\":\"gerard.soldevila@elastic.co\"},\"sourceCommit\":{\"committedDate\":\"2023-09-01T10:41:20Z\",\"message\":\"[esArchiver]\nDo not perform SO migration on cleanup (#163302)\\n\\n##\nSummary\\r\\n\\r\\nAttempt at fixing\nhttps://github.com/elastic/kibana/issues/127545\\r\\n\\r\\nThe failing tests\nuse `esArchiver` to cleanup Saved Object indices\\r\\nbetween\ntests.\\r\\nStrangely, the cleanup method calls the migration logic to\nupdate the SO\\r\\nindices.\\r\\n\\r\\nIn this particular source of flakiness,\na test fails during the\\r\\nmigration (problem is tracked\nby\\r\\nhttps://github.com/elastic/kibana/issues/163289).\\r\\n\\r\\nPerforming\na migration as part of the cleanup does not make too much\\r\\nsense (at\nleast in this test suite), so the goal of this PR is to\\r\\nsimplify the\ncleanup operation, getting rid of the call\nto\\r\\n`migrateSavedObjectIndices`.\\r\\n\\r\\n50 runs flaky test\nrunner\\r\\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2850\\r\\n✅\",\"sha\":\"f8303ec7cf57aa8787331ada397dfa853de969c9\",\"branchLabelMapping\":{\"^v8.11.0$\":\"main\",\"^v(\\\\d+).(\\\\d+).\\\\d+$\":\"$1.$2\"}},\"sourcePullRequest\":{\"labels\":[\"bug\",\"Team:Core\",\"Team:Operations\",\"release_note:skip\",\"test-failure-flaky\",\"backport:all-open\",\"v8.11.0\"],\"number\":163302,\"url\":\"https://github.com/elastic/kibana/pull/163302\",\"mergeCommit\":{\"message\":\"[esArchiver]\nDo not perform SO migration on cleanup (#163302)\\n\\n##\nSummary\\r\\n\\r\\nAttempt at fixing\nhttps://github.com/elastic/kibana/issues/127545\\r\\n\\r\\nThe failing tests\nuse `esArchiver` to cleanup Saved Object indices\\r\\nbetween\ntests.\\r\\nStrangely, the cleanup method calls the migration logic to\nupdate the SO\\r\\nindices.\\r\\n\\r\\nIn this particular source of flakiness,\na test fails during the\\r\\nmigration (problem is tracked\nby\\r\\nhttps://github.com/elastic/kibana/issues/163289).\\r\\n\\r\\nPerforming\na migration as part of the cleanup does not make too much\\r\\nsense (at\nleast in this test suite), so the goal of this PR is to\\r\\nsimplify the\ncleanup operation, getting rid of the call\nto\\r\\n`migrateSavedObjectIndices`.\\r\\n\\r\\n50 runs flaky test\nrunner\\r\\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2850\\r\\n✅\",\"sha\":\"f8303ec7cf57aa8787331ada397dfa853de969c9\"}},\"sourceBranch\":\"main\",\"suggestedTargetBranches\":[],\"targetPullRequestStates\":[{\"branch\":\"main\",\"label\":\"v8.11.0\",\"labelRegex\":\"^v8.11.0$\",\"isSourceBranch\":true,\"state\":\"MERGED\",\"url\":\"https://github.com/elastic/kibana/pull/163302\",\"number\":163302,\"mergeCommit\":{\"message\":\"[esArchiver]\nDo not perform SO migration on cleanup (#163302)\\n\\n##\nSummary\\r\\n\\r\\nAttempt at fixing\nhttps://github.com/elastic/kibana/issues/127545\\r\\n\\r\\nThe failing tests\nuse `esArchiver` to cleanup Saved Object indices\\r\\nbetween\ntests.\\r\\nStrangely, the cleanup method calls the migration logic to\nupdate the SO\\r\\nindices.\\r\\n\\r\\nIn this particular source of flakiness,\na test fails during the\\r\\nmigration (problem is tracked\nby\\r\\nhttps://github.com/elastic/kibana/issues/163289).\\r\\n\\r\\nPerforming\na migration as part of the cleanup does not make too much\\r\\nsense (at\nleast in this test suite), so the goal of this PR is to\\r\\nsimplify the\ncleanup operation, getting rid of the call\nto\\r\\n`migrateSavedObjectIndices`.\\r\\n\\r\\n50 runs flaky test\nrunner\\r\\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2850\\r\\n✅\",\"sha\":\"f8303ec7cf57aa8787331ada397dfa853de969c9\"}}]}]\nBACKPORT-->\n\nCo-authored-by: Gerard Soldevila <gerard.soldevila@elastic.co>"}},{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/163302","number":163302,"mergeCommit":{"message":"[esArchiver] Do not perform SO migration on cleanup (#163302)\n\n## Summary\r\n\r\nAttempt at fixing https://github.com/elastic/kibana/issues/127545\r\n\r\nThe failing tests use `esArchiver` to cleanup Saved Object indices\r\nbetween tests.\r\nStrangely, the cleanup method calls the migration logic to update the SO\r\nindices.\r\n\r\nIn this particular source of flakiness, a test fails during the\r\nmigration (problem is tracked by\r\nhttps://github.com/elastic/kibana/issues/163289).\r\n\r\nPerforming a migration as part of the cleanup does not make too much\r\nsense (at least in this test suite), so the goal of this PR is to\r\nsimplify the cleanup operation, getting rid of the call to\r\n`migrateSavedObjectIndices`.\r\n\r\n50 runs flaky test runner\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2850\r\n✅","sha":"f8303ec7cf57aa8787331ada397dfa853de969c9"}}]}] BACKPORT-->
This commit is contained in:
parent
f402856cd1
commit
757e867d36
11 changed files with 45 additions and 25 deletions
|
@ -7,24 +7,22 @@
|
|||
*/
|
||||
|
||||
import type { KibanaClient } from '@elastic/elasticsearch/api/kibana';
|
||||
import { ToolingLog } from '@kbn/dev-utils';
|
||||
import { KbnClient } from '@kbn/test';
|
||||
import type { ToolingLog } from '@kbn/dev-utils';
|
||||
|
||||
import { migrateSavedObjectIndex, createStats, cleanSavedObjectIndices } from '../lib';
|
||||
import { createStats, cleanSavedObjectIndices } from '../lib';
|
||||
import { ALL_SAVED_OBJECT_INDICES } from '../lib/indices/constants';
|
||||
|
||||
export async function emptyKibanaIndexAction({
|
||||
client,
|
||||
log,
|
||||
kbnClient,
|
||||
}: {
|
||||
client: KibanaClient;
|
||||
log: ToolingLog;
|
||||
kbnClient: KbnClient;
|
||||
}) {
|
||||
const stats = createStats('emptyKibanaIndex', log);
|
||||
|
||||
await cleanSavedObjectIndices({ client, stats, log });
|
||||
await migrateSavedObjectIndex({ kbnClient });
|
||||
stats.createdIndex('.kibana');
|
||||
await client.indices.refresh({ index: ALL_SAVED_OBJECT_INDICES });
|
||||
|
||||
return stats.toJSON();
|
||||
}
|
||||
|
|
|
@ -153,14 +153,12 @@ export class EsArchiver {
|
|||
}
|
||||
|
||||
/**
|
||||
* Delete any Kibana indices, and initialize the Kibana index as Kibana would do
|
||||
* on startup.
|
||||
* Cleanup saved object indices, preserving the space:default saved object.
|
||||
*/
|
||||
async emptyKibanaIndex() {
|
||||
return await emptyKibanaIndexAction({
|
||||
client: this.client,
|
||||
log: this.log,
|
||||
kbnClient: this.kbnClient,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -10,9 +10,10 @@ import { inspect } from 'util';
|
|||
|
||||
import type { KibanaClient } from '@elastic/elasticsearch/api/kibana';
|
||||
import type { estypes } from '@elastic/elasticsearch';
|
||||
import { ToolingLog } from '@kbn/dev-utils';
|
||||
import { KbnClient } from '@kbn/test';
|
||||
import { Stats } from '../stats';
|
||||
import type { ToolingLog } from '@kbn/dev-utils';
|
||||
import type { KbnClient } from '@kbn/test';
|
||||
import { kibanaPackageJson } from '@kbn/utils';
|
||||
import type { Stats } from '../stats';
|
||||
import { deleteIndex } from './delete_index';
|
||||
import { ES_CLIENT_HEADERS } from '../../client_headers';
|
||||
import {
|
||||
|
@ -123,7 +124,8 @@ export async function cleanSavedObjectIndices({
|
|||
bool: {
|
||||
must_not: {
|
||||
ids: {
|
||||
values: ['space:default'],
|
||||
// preserve the default space and the default config
|
||||
values: ['space:default', `config:${kibanaPackageJson.version}`],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -31,7 +31,7 @@ export function extendEsArchiver({ esArchiver, kibanaServer, retry, defaults }:
|
|||
ES_ARCHIVER_LOAD_METHODS.forEach((method) => {
|
||||
const originalMethod = esArchiver[method];
|
||||
|
||||
esArchiver[method] = async (...args: unknown[]) => {
|
||||
esArchiver[method] = async (...args: any[]) => {
|
||||
// esArchiver methods return a stats object, with information about the indexes created
|
||||
const stats = await originalMethod.apply(esArchiver, args as any);
|
||||
|
||||
|
|
|
@ -35,7 +35,8 @@ export class HomePageObject extends FtrService {
|
|||
}
|
||||
|
||||
async isWelcomeInterstitialDisplayed() {
|
||||
return await this.testSubjects.isDisplayed('homeWelcomeInterstitial');
|
||||
await this.common.sleep(500); // give the interstitial enough time to fade in
|
||||
return await this.testSubjects.isDisplayed('homeWelcomeInterstitial', 2000);
|
||||
}
|
||||
|
||||
async getVisibileSolutions() {
|
||||
|
|
|
@ -74,6 +74,11 @@ class BrowserService extends FtrService {
|
|||
return await this.driver.manage().window().getRect();
|
||||
}
|
||||
|
||||
public async getWindowInnerSize(): Promise<{ height: number; width: number }> {
|
||||
const JS_GET_INNER_WIDTH = 'return { width: window.innerWidth, height: window.innerHeight };';
|
||||
return await this.driver.executeScript(JS_GET_INNER_WIDTH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the dimensions of a window.
|
||||
* https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/webdriver_exports_Window.html
|
||||
|
|
|
@ -226,9 +226,9 @@ export class TestSubjects extends FtrService {
|
|||
return await element.isEnabled();
|
||||
}
|
||||
|
||||
public async isDisplayed(selector: string): Promise<boolean> {
|
||||
public async isDisplayed(selector: string, timeout?: number): Promise<boolean> {
|
||||
this.log.debug(`TestSubjects.isDisplayed(${selector})`);
|
||||
const element = await this.find(selector);
|
||||
const element = await this.find(selector, timeout);
|
||||
return await element.isDisplayed();
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
|
|||
before(async () => {
|
||||
await esArchiver.emptyKibanaIndex();
|
||||
await PageObjects.common.navigateToApp('foo');
|
||||
await PageObjects.common.dismissBanner();
|
||||
});
|
||||
|
||||
it('starts on home page', async () => {
|
||||
|
@ -125,7 +126,7 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
|
|||
expect(await testSubjects.exists('headerGlobalNav')).to.be(false);
|
||||
|
||||
const wrapperHeight = await getAppWrapperHeight();
|
||||
const windowHeight = (await browser.getWindowSize()).height;
|
||||
const windowHeight = (await browser.getWindowInnerSize()).height;
|
||||
expect(wrapperHeight).to.eql(windowHeight);
|
||||
});
|
||||
|
||||
|
@ -135,7 +136,7 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
|
|||
expect(await testSubjects.exists('headerGlobalNav')).to.be(true);
|
||||
|
||||
const wrapperHeight = await getAppWrapperHeight();
|
||||
const windowHeight = (await browser.getWindowSize()).height;
|
||||
const windowHeight = (await browser.getWindowInnerSize()).height;
|
||||
expect(wrapperHeight).to.be.below(windowHeight);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -128,7 +128,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
});
|
||||
|
||||
it('should launch sample flights data set dashboard', async () => {
|
||||
await appMenu.clickLink('Dashboard');
|
||||
await PageObjects.common.navigateToApp('dashboard');
|
||||
await PageObjects.dashboard.loadSavedDashboard('[Flights] Global Flight Dashboard');
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await PageObjects.timePicker.setCommonlyUsedTime('sample_data range');
|
||||
|
@ -144,7 +144,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
const hitCount = parseInt(await PageObjects.discover.getHitCount(), 10);
|
||||
expect(hitCount).to.be.greaterThan(0);
|
||||
});
|
||||
await appMenu.clickLink('Dashboard');
|
||||
await appMenu.clickLink('Dashboard', {
|
||||
category: 'recentlyViewed',
|
||||
closeCollapsibleNav: true,
|
||||
});
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await renderable.waitForRender();
|
||||
log.debug('Checking charts rendered');
|
||||
|
@ -157,7 +160,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
const hitCount = parseInt(await PageObjects.discover.getHitCount(), 10);
|
||||
expect(hitCount).to.be.greaterThan(0);
|
||||
});
|
||||
await appMenu.clickLink('Dashboard');
|
||||
await appMenu.clickLink('Dashboard', {
|
||||
category: 'recentlyViewed',
|
||||
closeCollapsibleNav: true,
|
||||
});
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await renderable.waitForRender();
|
||||
log.debug('Checking charts rendered');
|
||||
|
@ -170,7 +176,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
const hitCount = parseInt(await PageObjects.discover.getHitCount(), 10);
|
||||
expect(hitCount).to.be.greaterThan(0);
|
||||
});
|
||||
await appMenu.clickLink('Dashboard');
|
||||
await appMenu.clickLink('Dashboard', {
|
||||
category: 'recentlyViewed',
|
||||
closeCollapsibleNav: true,
|
||||
});
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await renderable.waitForRender();
|
||||
log.debug('Checking charts rendered');
|
||||
|
|
|
@ -59,7 +59,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
});
|
||||
|
||||
if (!saveToDashboard) {
|
||||
await appsMenu.clickLink('Dashboard');
|
||||
await appsMenu.clickLink('Dashboard', {
|
||||
category: 'kibana',
|
||||
closeCollapsibleNav: true,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
await PageObjects.maps.clickSaveAndReturnButton();
|
||||
|
|
|
@ -28,6 +28,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
};
|
||||
|
||||
const getReport = async () => {
|
||||
// close any open notification toasts
|
||||
await PageObjects.reporting.clearToastNotifications();
|
||||
|
||||
await PageObjects.reporting.openCsvReportingPanel();
|
||||
await PageObjects.reporting.clickGenerateReportButton();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue