diff --git a/x-pack/test/common/services/ingest_manager.ts b/x-pack/test/common/services/ingest_manager.ts index 1ef80be40d803..c3187213d905d 100644 --- a/x-pack/test/common/services/ingest_manager.ts +++ b/x-pack/test/common/services/ingest_manager.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { fleetSetupRouteService } from '@kbn/fleet-plugin/common'; +import { API_VERSIONS, fleetSetupRouteService } from '@kbn/fleet-plugin/common'; +import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; import { FtrProviderContext } from '../ftr_provider_context'; export function IngestManagerProvider({ getService }: FtrProviderContext) { @@ -18,6 +19,7 @@ export function IngestManagerProvider({ getService }: FtrProviderContext) { await retry.try(async () => { await supertest .post(fleetSetupRouteService.postFleetSetupPath()) + .set(ELASTIC_HTTP_VERSION_HEADER, API_VERSIONS.public.v1) .set(headers) .send({ forceRecreate: true }) .expect(200); diff --git a/x-pack/test/functional/page_objects/infra_hosts_view.ts b/x-pack/test/functional/page_objects/infra_hosts_view.ts index 4dda165ea96a7..83628e1eae02a 100644 --- a/x-pack/test/functional/page_objects/infra_hosts_view.ts +++ b/x-pack/test/functional/page_objects/infra_hosts_view.ts @@ -4,6 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ + import { AlertStatus } from '@kbn/rule-data-utils'; import { WebElementWrapper } from '../../../../test/functional/services/lib/web_element_wrapper'; import { FtrProviderContext } from '../ftr_provider_context'; 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 1caef61bec80c..67115c1610157 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 @@ -8,14 +8,14 @@ import { Client } from '@elastic/elasticsearch'; import { AGENTS_INDEX } from '@kbn/fleet-plugin/common'; import { - metadataIndexPattern, - eventsIndexPattern, alertsIndexPattern, - policyIndexPattern, + eventsIndexPattern, + METADATA_DATASTREAM, + METADATA_UNITED_INDEX, metadataCurrentIndexPattern, + metadataIndexPattern, + policyIndexPattern, telemetryIndexPattern, - METADATA_UNITED_INDEX, - METADATA_DATASTREAM, } from '@kbn/security-solution-plugin/common/endpoint/constants'; export function deleteDataStream(getService: (serviceName: 'es') => Client, index: string) { @@ -38,10 +38,8 @@ export async function deleteAllDocsFromIndex( const client = getService('es'); await client.deleteByQuery( { - body: { - query: { - match_all: {}, - }, + query: { + match_all: {}, }, index, wait_for_completion: true, @@ -132,12 +130,12 @@ export function bulkIndex( index: string, docs: unknown[] ) { - const body = docs.flatMap((doc) => [{ create: { _index: index } }, doc]); + const operations = docs.flatMap((doc) => [{ create: { _index: index } }, doc]); const client = getService('es'); return client.bulk({ index, refresh: 'wait_for', - body, + operations, }); } diff --git a/x-pack/test/security_solution_endpoint_api_int/apis/index.ts b/x-pack/test/security_solution_endpoint_api_int/apis/index.ts index e68db8182da20..06d54f0aaac45 100644 --- a/x-pack/test/security_solution_endpoint_api_int/apis/index.ts +++ b/x-pack/test/security_solution_endpoint_api_int/apis/index.ts @@ -7,7 +7,7 @@ import { getRegistryUrl as getRegistryUrlFromIngest } from '@kbn/fleet-plugin/server'; import { FtrProviderContext } from '../ftr_provider_context'; -import { isRegistryEnabled, getRegistryUrlFromTestEnv } from '../registry'; +import { getRegistryUrlFromTestEnv, isRegistryEnabled } from '../registry'; import { ROLE } from '../services/roles_users'; export default function endpointAPIIntegrationTests(providerContext: FtrProviderContext) { @@ -28,7 +28,11 @@ export default function endpointAPIIntegrationTests(providerContext: FtrProvider const roles = Object.values(ROLE); before(async () => { - await ingestManager.setup(); + try { + await ingestManager.setup(); + } catch (err) { + log.warning(`Error setting up ingestManager: ${err}`); + } // create role/user for (const role of roles) { 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 c4778f7039a91..a015cf693895e 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 @@ -9,14 +9,14 @@ import { v4 as uuidv4 } from 'uuid'; import expect from '@kbn/expect'; import { TransformGetTransformStatsTransformStats } from '@elastic/elasticsearch/lib/api/types'; import { - METADATA_DATASTREAM, + ENDPOINT_DEFAULT_SORT_DIRECTION, + ENDPOINT_DEFAULT_SORT_FIELD, HOST_METADATA_LIST_ROUTE, + METADATA_DATASTREAM, + METADATA_TRANSFORMS_STATUS_ROUTE, METADATA_UNITED_INDEX, METADATA_UNITED_TRANSFORM, - METADATA_TRANSFORMS_STATUS_ROUTE, metadataTransformPrefix, - ENDPOINT_DEFAULT_SORT_FIELD, - ENDPOINT_DEFAULT_SORT_DIRECTION, } from '@kbn/security-solution-plugin/common/endpoint/constants'; import { AGENTS_INDEX } from '@kbn/fleet-plugin/common'; import { indexFleetEndpointPolicy } from '@kbn/security-solution-plugin/common/endpoint/data_loaders/index_fleet_endpoint_policy'; @@ -29,22 +29,22 @@ import { } from '@kbn/security-solution-plugin/common/endpoint/types'; import { generateAgentDocs, generateMetadataDocs } from './metadata.fixtures'; import { + bulkIndex, + deleteAllDocsFromFleetAgents, + deleteAllDocsFromIndex, deleteAllDocsFromMetadataCurrentIndex, deleteAllDocsFromMetadataDatastream, - stopTransform, startTransform, - deleteAllDocsFromFleetAgents, - deleteAllDocsFromIndex, - bulkIndex, + stopTransform, } from './data_stream_helper'; import { FtrProviderContext } from '../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); const endpointTestResources = getService('endpointTestResources'); + const log = getService('log'); - // Failing: See https://github.com/elastic/kibana/issues/151854 - describe.skip('test metadata apis', () => { + describe('test metadata apis', () => { describe('list endpoints GET route', () => { const numberOfHostsInFixture = 2; let agent1Timestamp: number; @@ -55,7 +55,11 @@ export default function ({ getService }: FtrProviderContext) { await deleteAllDocsFromFleetAgents(getService); await deleteAllDocsFromMetadataDatastream(getService); await deleteAllDocsFromMetadataCurrentIndex(getService); - await deleteAllDocsFromIndex(getService, METADATA_UNITED_INDEX); + try { + await deleteAllDocsFromIndex(getService, METADATA_UNITED_INDEX); + } catch (err) { + log.warning(`Unable to delete index: ${err}`); + } const customIndexFn = async (): Promise => { // generate an endpoint policy and attach id to agents since