Skip to content

Commit

Permalink
78024: fix tests, remove vestiges
Browse files Browse the repository at this point in the history
  • Loading branch information
nnamdifrankie committed Sep 24, 2020
1 parent cf31379 commit cf92665
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<IRouter>;
Expand Down Expand Up @@ -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,
},
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
});

Expand All @@ -87,21 +84,21 @@ 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);
});
});

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);
});

Expand Down Expand Up @@ -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 () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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}`)
Expand All @@ -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 () => {
Expand Down

0 comments on commit cf92665

Please sign in to comment.