From cf926654386faea2aa6c7ec1798be9565d0de48d Mon Sep 17 00:00:00 2001 From: nnamdifrankie Date: Thu, 24 Sep 2020 09:40:42 -0400 Subject: [PATCH] 78024: fix tests, remove vestiges --- .../endpoint/routes/metadata/metadata.test.ts | 3 ++- .../apps/endpoint/endpoint_list.ts | 14 +++++--------- .../apis/data_stream_helper.ts | 4 ---- .../apis/metadata.ts | 3 --- 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/metadata.test.ts b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/metadata.test.ts index 299939eb92444..227a3e6fd9657 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/metadata.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/metadata.test.ts @@ -42,6 +42,7 @@ import { } from '../../../../../ingest_manager/common/types/models'; import { createV1SearchResponse, createV2SearchResponse } from './support/test_support'; import { PackageService } from '../../../../../ingest_manager/server/services'; +import { metadataTransformPrefix } from '../../../../common/endpoint/constants'; describe('test endpoint route', () => { let routerMock: jest.Mocked; @@ -175,7 +176,7 @@ describe('test endpoint route', () => { type: ElasticsearchAssetType.indexTemplate, }, { - id: 'metrics-endpoint.metadata-current-default-0.16.0-dev.0', + id: `${metadataTransformPrefix}-0.16.0-dev.0`, type: ElasticsearchAssetType.transform, }, ]) diff --git a/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_list.ts b/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_list.ts index 4beb64affc46b..cac5da9ebc992 100644 --- a/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_list.ts +++ b/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_list.ts @@ -8,7 +8,6 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; import { - deleteMetadataCurrentStream, deleteMetadataStream, deleteAllDocsFromMetadataCurrentIndex, } from '../../../security_solution_endpoint_api_int/apis/data_stream_helper'; @@ -72,13 +71,11 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { describe('when initially navigating to page', () => { before(async () => { await deleteMetadataStream(getService); - await deleteMetadataCurrentStream(getService); await deleteAllDocsFromMetadataCurrentIndex(getService); await pageObjects.endpoint.navigateToEndpointList(); }); after(async () => { await deleteMetadataStream(getService); - await deleteMetadataCurrentStream(getService); await deleteAllDocsFromMetadataCurrentIndex(getService); }); @@ -87,8 +84,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { }); it('finds data after load and polling', async () => { - await esArchiver.load('endpoint/metadata/destination_index', { useCreate: true }); - await pageObjects.endpoint.waitForTableToHaveData('endpointListTable', 1100); + await esArchiver.load('endpoint/metadata/api_feature', { useCreate: true }); + await pageObjects.endpoint.waitForTableToHaveData('endpointListTable', 100000); const tableData = await pageObjects.endpointPageUtils.tableData('endpointListTable'); expect(tableData).to.eql(expectedData); }); @@ -96,12 +93,12 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { describe('when there is data,', () => { before(async () => { - await esArchiver.load('endpoint/metadata/destination_index', { useCreate: true }); + await esArchiver.load('endpoint/metadata/api_feature', { useCreate: true }); + await sleep(100000); await pageObjects.endpoint.navigateToEndpointList(); }); after(async () => { await deleteMetadataStream(getService); - await deleteMetadataCurrentStream(getService); await deleteAllDocsFromMetadataCurrentIndex(getService); }); @@ -214,12 +211,11 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { describe('displays the correct table data for the kql queries', () => { before(async () => { - await esArchiver.load('endpoint/metadata/destination_index', { useCreate: true }); + await esArchiver.load('endpoint/metadata/api_feature', { useCreate: true }); await pageObjects.endpoint.navigateToEndpointList(); }); after(async () => { await deleteMetadataStream(getService); - await deleteMetadataCurrentStream(getService); await deleteAllDocsFromMetadataCurrentIndex(getService); }); it('for the kql query: na, table shows an empty list', async () => { diff --git a/x-pack/test/security_solution_endpoint_api_int/apis/data_stream_helper.ts b/x-pack/test/security_solution_endpoint_api_int/apis/data_stream_helper.ts index f1c05b2fc8f20..8e5f8c71068a8 100644 --- a/x-pack/test/security_solution_endpoint_api_int/apis/data_stream_helper.ts +++ b/x-pack/test/security_solution_endpoint_api_int/apis/data_stream_helper.ts @@ -51,10 +51,6 @@ export async function deleteMetadataStream(getService: (serviceName: 'es') => Cl await deleteDataStream(getService, metadataIndexPattern); } -export async function deleteMetadataCurrentStream(getService: (serviceName: 'es') => Client) { - await deleteDataStream(getService, metadataCurrentIndexPattern); -} - export async function deleteAllDocsFromMetadataIndex(getService: (serviceName: 'es') => Client) { await deleteAllDocsFromIndex(getService, metadataIndexPattern); } diff --git a/x-pack/test/security_solution_endpoint_api_int/apis/metadata.ts b/x-pack/test/security_solution_endpoint_api_int/apis/metadata.ts index b157c3159ccc0..50f3374b7b84d 100644 --- a/x-pack/test/security_solution_endpoint_api_int/apis/metadata.ts +++ b/x-pack/test/security_solution_endpoint_api_int/apis/metadata.ts @@ -7,7 +7,6 @@ import expect from '@kbn/expect/expect.js'; import { FtrProviderContext } from '../ftr_provider_context'; import { deleteAllDocsFromMetadataCurrentIndex, - deleteMetadataCurrentStream, deleteAllDocsFromMetadataIndex, deleteMetadataStream, } from './data_stream_helper'; @@ -28,7 +27,6 @@ export default function ({ getService }: FtrProviderContext) { it('metadata api should return empty result when index is empty', async () => { await deleteMetadataStream(getService); await deleteAllDocsFromMetadataIndex(getService); - await deleteMetadataCurrentStream(getService); await deleteAllDocsFromMetadataCurrentIndex(getService); const { body } = await supertest .post(`${METADATA_REQUEST_ROUTE}`) @@ -53,7 +51,6 @@ export default function ({ getService }: FtrProviderContext) { after(async () => { await deleteMetadataStream(getService); await deleteAllDocsFromMetadataIndex(getService); - await deleteMetadataCurrentStream(getService); await deleteAllDocsFromMetadataCurrentIndex(getService); }); it('metadata api should return one entry for each host with default paging', async () => {