diff --git a/packages/kbn-apm-synthtrace/src/lib/infra/infra_synthtrace_es_client.ts b/packages/kbn-apm-synthtrace/src/lib/infra/infra_synthtrace_es_client.ts index dcd5e6da2d261e..7aac8cfb1aad46 100644 --- a/packages/kbn-apm-synthtrace/src/lib/infra/infra_synthtrace_es_client.ts +++ b/packages/kbn-apm-synthtrace/src/lib/infra/infra_synthtrace_es_client.ts @@ -27,8 +27,6 @@ export class InfraSynthtraceEsClient extends SynthtraceEsClient { 'metrics-kubernetes*', 'metrics-docker*', 'metrics-aws*', - 'metricbeat-*', - 'logs-*', ]; } } diff --git a/x-pack/test/functional/apps/infra/home_page.ts b/x-pack/test/functional/apps/infra/home_page.ts index 50e055f5bc6bfa..339c71c42e5bff 100644 --- a/x-pack/test/functional/apps/infra/home_page.ts +++ b/x-pack/test/functional/apps/infra/home_page.ts @@ -74,11 +74,16 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { describe('Home page', function () { this.tags('includeFirefox'); + let synthEsClient: InfraSynthtraceEsClient; before(async () => { + synthEsClient = await getInfraSynthtraceEsClient(esClient); await kibanaServer.savedObjects.cleanStandardList(); + return synthEsClient.clean(); }); + after(() => synthEsClient.clean()); + describe('without metrics present', () => { it('renders an empty data prompt and redirects to the onboarding page', async () => { await pageObjects.common.navigateToApp('infraOps'); @@ -110,10 +115,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { }); describe('with metrics present', () => { - let synthEsClient: InfraSynthtraceEsClient; before(async () => { - synthEsClient = await getInfraSynthtraceEsClient(esClient); - await synthEsClient.clean(); await synthEsClient.index([ generateHostData({ from: DATE_WITH_HOSTS_DATA_FROM, @@ -134,10 +136,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await pageObjects.common.navigateToApp('infraOps'); await pageObjects.infraHome.waitForLoading(); }); - after(async () => { - await browser.removeLocalStorageItem(KUBERNETES_TOUR_STORAGE_KEY); - await synthEsClient.clean(); - }); + + after(async () => browser.removeLocalStorageItem(KUBERNETES_TOUR_STORAGE_KEY)); it('renders the correct page title', async () => { await pageObjects.header.waitUntilLoadingHasFinished(); diff --git a/x-pack/test/functional/apps/infra/hosts_view.ts b/x-pack/test/functional/apps/infra/hosts_view.ts index 5f2dd01bb980e4..90c2b2fdfc9c11 100644 --- a/x-pack/test/functional/apps/infra/hosts_view.ts +++ b/x-pack/test/functional/apps/infra/hosts_view.ts @@ -298,15 +298,38 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { (await pageObjects.infraHostsView.isKPIChartsLoaded()) ); - // Failing: See https://github.com/elastic/kibana/issues/191806 - describe.skip('Hosts View', function () { + describe('Hosts View', function () { let synthEsInfraClient: InfraSynthtraceEsClient; let syntEsLogsClient: LogsSynthtraceEsClient; + let synthtraceApmClient: ApmSynthtraceEsClient; + + before(async () => { + synthEsInfraClient = await getInfraSynthtraceEsClient(esClient); + syntEsLogsClient = await getLogsSynthtraceEsClient(esClient); + const version = (await apmSynthtraceKibanaClient.installApmPackage()).version; + synthtraceApmClient = await getApmSynthtraceEsClient({ + client: esClient, + packageVersion: version, + }); + + return Promise.all([ + synthtraceApmClient.clean(), + synthEsInfraClient.clean(), + syntEsLogsClient.clean(), + ]); + }); + + after(async () => { + return Promise.all([ + apmSynthtraceKibanaClient.uninstallApmPackage(), + synthtraceApmClient.clean(), + synthEsInfraClient.clean(), + syntEsLogsClient.clean(), + ]); + }); describe('#Onboarding', function () { before(async () => { - synthEsInfraClient = await getInfraSynthtraceEsClient(esClient); - await synthEsInfraClient.clean(); await pageObjects.common.navigateToApp(HOSTS_VIEW_PATH); }); @@ -325,14 +348,11 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { }); describe('#With data', function () { - let synthtraceApmClient: ApmSynthtraceEsClient; before(async () => { - synthEsInfraClient = await getInfraSynthtraceEsClient(esClient); - syntEsLogsClient = await getLogsSynthtraceEsClient(esClient); - const version = (await apmSynthtraceKibanaClient.installApmPackage()).version; - synthtraceApmClient = await getApmSynthtraceEsClient({ - client: esClient, - packageVersion: version, + const hosts = generateHostData({ + from: DATE_WITH_HOSTS_DATA_FROM, + to: DATE_WITH_HOSTS_DATA_TO, + hosts: SYNTH_HOSTS, }); const services = generateAddServicesToExistingHost({ @@ -350,26 +370,15 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await browser.setWindowSize(1600, 1200); - return Promise.all([ + await Promise.all([ + synthEsInfraClient.index(hosts), synthtraceApmClient.index(services), - synthEsInfraClient.index( - generateHostData({ - from: DATE_WITH_HOSTS_DATA_FROM, - to: DATE_WITH_HOSTS_DATA_TO, - hosts: SYNTH_HOSTS, - }) - ), syntEsLogsClient.index(logs), ]); }); after(async () => { - return Promise.all([ - apmSynthtraceKibanaClient.uninstallApmPackage(), - synthtraceApmClient.clean(), - synthEsInfraClient.clean(), - browser.removeLocalStorageItem(HOSTS_LINK_LOCAL_STORAGE_KEY), - ]); + return browser.removeLocalStorageItem(HOSTS_LINK_LOCAL_STORAGE_KEY); }); describe('#Single Host Flyout', () => { diff --git a/x-pack/test/functional/apps/infra/index.ts b/x-pack/test/functional/apps/infra/index.ts index 5ad5c004c30c9b..999d7342f46394 100644 --- a/x-pack/test/functional/apps/infra/index.ts +++ b/x-pack/test/functional/apps/infra/index.ts @@ -15,11 +15,12 @@ export default ({ loadTestFile }: FtrProviderContext) => { describe('Metrics UI', function () { loadTestFile(require.resolve('./home_page')); - loadTestFile(require.resolve('./metrics_source_configuration')); loadTestFile(require.resolve('./metrics_anomalies')); loadTestFile(require.resolve('./metrics_explorer')); loadTestFile(require.resolve('./node_details')); loadTestFile(require.resolve('./hosts_view')); + // keep this test last as it can potentially break other tests + loadTestFile(require.resolve('./metrics_source_configuration')); }); describe('Logs UI', function () { diff --git a/x-pack/test/functional/apps/infra/metrics_source_configuration.ts b/x-pack/test/functional/apps/infra/metrics_source_configuration.ts index 177e675785a41c..46d20489e4d36c 100644 --- a/x-pack/test/functional/apps/infra/metrics_source_configuration.ts +++ b/x-pack/test/functional/apps/infra/metrics_source_configuration.ts @@ -31,17 +31,22 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { const kibanaServer = getService('kibanaServer'); describe('Infrastructure Source Configuration', function () { - before(async () => kibanaServer.savedObjects.cleanStandardList()); - after(async () => kibanaServer.savedObjects.cleanStandardList()); + before(async () => + Promise.all([ + esArchiver.load('x-pack/test/functional/es_archives/infra/alerts'), + esArchiver.load('x-pack/test/functional/es_archives/infra/metrics_and_logs'), + kibanaServer.savedObjects.cleanStandardList(), + ]) + ); + after(async () => + Promise.all([ + esArchiver.unload('x-pack/test/functional/es_archives/infra/alerts'), + esArchiver.unload('x-pack/test/functional/es_archives/infra/metrics_and_logs'), + kibanaServer.savedObjects.cleanStandardList(), + ]) + ); describe('with metrics present', () => { - before(async () => - esArchiver.load('x-pack/test/functional/es_archives/infra/metrics_and_logs') - ); - after(async () => - esArchiver.unload('x-pack/test/functional/es_archives/infra/metrics_and_logs') - ); - it('renders the waffle map', async () => { await pageObjects.common.navigateToApp('infraOps'); await pageObjects.infraHome.goToTime(DATE_WITH_DATA); diff --git a/x-pack/test/functional/apps/infra/node_details.ts b/x-pack/test/functional/apps/infra/node_details.ts index 4d31091caabb53..f88a5cfb736a96 100644 --- a/x-pack/test/functional/apps/infra/node_details.ts +++ b/x-pack/test/functional/apps/infra/node_details.ts @@ -139,19 +139,16 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { let synthEsClient: InfraSynthtraceEsClient; before(async () => { synthEsClient = await getInfraSynthtraceEsClient(esClient); - await synthEsClient.clean(); await kibanaServer.savedObjects.cleanStandardList(); await browser.setWindowSize(1600, 1200); - }); - after(async () => { - await synthEsClient.clean(); + return synthEsClient.clean(); }); + after(() => synthEsClient.clean()); + describe('#Asset Type: host', () => { before(async () => { - synthEsClient = await getInfraSynthtraceEsClient(esClient); - await synthEsClient.clean(); await synthEsClient.index( generateHostData({ from: DATE_WITH_HOSTS_DATA_FROM, @@ -159,20 +156,15 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { hosts: HOSTS, }) ); + await navigateToNodeDetails('host-1', 'host', { name: 'host-1', }); await pageObjects.header.waitUntilLoadingHasFinished(); - await pageObjects.timePicker.setAbsoluteRange( - START_HOST_DATE.format(DATE_PICKER_FORMAT), - END_HOST_DATE.format(DATE_PICKER_FORMAT) - ); }); - after(async () => { - await synthEsClient.clean(); - }); + after(() => synthEsClient.clean()); it('preserves selected tab between page reloads', async () => { await testSubjects.missingOrFail('infraAssetDetailsMetadataTable'); @@ -633,8 +625,6 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { describe('#Asset type: host with kubernetes section', () => { before(async () => { - synthEsClient = await getInfraSynthtraceEsClient(esClient); - await synthEsClient.clean(); await synthEsClient.index( generateHostsWithK8sNodeData({ from: DATE_WITH_HOSTS_DATA_FROM, @@ -651,9 +641,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { ); }); - after(async () => { - await synthEsClient.clean(); - }); + after(() => synthEsClient.clean()); describe('Overview Tab', () => { before(async () => { @@ -727,8 +715,6 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { describe('#Asset Type: container', () => { before(async () => { - synthEsClient = await getInfraSynthtraceEsClient(esClient); - await synthEsClient.clean(); await synthEsClient.index( generateDockerContainersData({ from: DATE_WITH_DOCKER_DATA_FROM, @@ -744,9 +730,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { ); }); - after(async () => { - await synthEsClient.clean(); - }); + after(() => synthEsClient.clean()); describe('when container asset view is disabled', () => { before(async () => {