mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[esArchiver] Do not perform SO migration on cleanup (#163302)
## Summary Attempt at fixing https://github.com/elastic/kibana/issues/127545 The failing tests use `esArchiver` to cleanup Saved Object indices between tests. Strangely, the cleanup method calls the migration logic to update the SO indices. In this particular source of flakiness, a test fails during the migration (problem is tracked by https://github.com/elastic/kibana/issues/163289). Performing a migration as part of the cleanup does not make too much sense (at least in this test suite), so the goal of this PR is to simplify the cleanup operation, getting rid of the call to `migrateSavedObjectIndices`. 50 runs flaky test runner https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2850 ✅
This commit is contained in:
parent
af6fb117b5
commit
f8303ec7cf
10 changed files with 39 additions and 28 deletions
|
@ -8,25 +8,15 @@
|
|||
|
||||
import type { Client } from '@elastic/elasticsearch';
|
||||
import { ToolingLog } from '@kbn/tooling-log';
|
||||
import { KbnClient } from '@kbn/test';
|
||||
|
||||
import { ALL_SAVED_OBJECT_INDICES } from '@kbn/core-saved-objects-server';
|
||||
import { migrateSavedObjectIndices, createStats, cleanSavedObjectIndices } from '../lib';
|
||||
import { createStats, cleanSavedObjectIndices } from '../lib';
|
||||
|
||||
export async function emptyKibanaIndexAction({
|
||||
client,
|
||||
log,
|
||||
kbnClient,
|
||||
}: {
|
||||
client: Client;
|
||||
log: ToolingLog;
|
||||
kbnClient: KbnClient;
|
||||
}) {
|
||||
export async function emptyKibanaIndexAction({ client, log }: { client: Client; log: ToolingLog }) {
|
||||
const stats = createStats('emptyKibanaIndex', log);
|
||||
|
||||
await cleanSavedObjectIndices({ client, stats, log });
|
||||
await migrateSavedObjectIndices(kbnClient);
|
||||
await client.indices.refresh({ index: ALL_SAVED_OBJECT_INDICES });
|
||||
ALL_SAVED_OBJECT_INDICES.forEach((indexPattern) => stats.createdIndex(indexPattern));
|
||||
|
||||
return stats.toJSON();
|
||||
}
|
||||
|
|
|
@ -154,14 +154,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,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -167,6 +167,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
// click "see full error" button in the toast
|
||||
const [openShardModalButton] = await testSubjects.findAll('openShardFailureModalBtn');
|
||||
await openShardModalButton.click();
|
||||
await testSubjects.exists('shardFailureModalTitle');
|
||||
const modalHeader = await testSubjects.find('shardFailureModalTitle');
|
||||
expect(await modalHeader.getVisibleText()).to.be('2 of 4 shards failed');
|
||||
// request
|
||||
|
|
|
@ -53,7 +53,9 @@ export class HomePageObject extends FtrService {
|
|||
}
|
||||
|
||||
async isWelcomeInterstitialDisplayed() {
|
||||
return await this.testSubjects.isDisplayed('homeWelcomeInterstitial');
|
||||
// give the interstitial enough time to fade in
|
||||
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||
return await this.testSubjects.isDisplayed('homeWelcomeInterstitial', 2000);
|
||||
}
|
||||
|
||||
async isGuidedOnboardingLandingDisplayed() {
|
||||
|
|
|
@ -73,6 +73,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
|
||||
|
|
|
@ -285,9 +285,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();
|
||||
}
|
||||
|
||||
|
|
|
@ -49,11 +49,11 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
|
|||
const navigateTo = async (path: string) =>
|
||||
await browser.navigateTo(`${deployment.getHostPort()}${path}`);
|
||||
|
||||
// FLAKY: https://github.com/elastic/kibana/issues/127545
|
||||
describe.skip('ui applications', function describeIndexTests() {
|
||||
describe('ui applications', function describeIndexTests() {
|
||||
before(async () => {
|
||||
await esArchiver.emptyKibanaIndex();
|
||||
await PageObjects.common.navigateToApp('foo');
|
||||
await PageObjects.common.dismissBanner();
|
||||
});
|
||||
|
||||
it('starts on home page', async () => {
|
||||
|
@ -126,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);
|
||||
});
|
||||
|
||||
|
@ -136,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');
|
||||
|
|
|
@ -60,7 +60,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();
|
||||
|
|
|
@ -29,6 +29,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