mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
[Security Solution][Endpoint] Unskip metadata API ftr test (#167226)
## Summary Adds an error handler block to help debug test setup errors during fleet agent setup for endpoint API ftr tests. Also adds missing header API version. fixes elastic/kibana/issues/151854 **flaky ftr test runners** - https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3223 x 150 (without header) - (1 fail) - https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3224 x 50 (all 50 pass) - https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3228 x 100 (2 fails) - https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3231 x 100 ( 1 fail) - https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3241 x 50 ( 2 fails) ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
b12a42261b
commit
428f3e05ec
5 changed files with 36 additions and 27 deletions
|
@ -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);
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -8,14 +8,14 @@
|
|||
import { Client } from '@elastic/elasticsearch';
|
||||
import { AGENTS_INDEX } from '@kbn/fleet-plugin/common';
|
||||
import {
|
||||
metadataIndexPattern,
|
||||
eventsIndexPattern,
|
||||
alertsIndexPattern,
|
||||
policyIndexPattern,
|
||||
metadataCurrentIndexPattern,
|
||||
telemetryIndexPattern,
|
||||
METADATA_UNITED_INDEX,
|
||||
eventsIndexPattern,
|
||||
METADATA_DATASTREAM,
|
||||
METADATA_UNITED_INDEX,
|
||||
metadataCurrentIndexPattern,
|
||||
metadataIndexPattern,
|
||||
policyIndexPattern,
|
||||
telemetryIndexPattern,
|
||||
} 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,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 {
|
||||
deleteAllDocsFromMetadataCurrentIndex,
|
||||
deleteAllDocsFromMetadataDatastream,
|
||||
stopTransform,
|
||||
startTransform,
|
||||
bulkIndex,
|
||||
deleteAllDocsFromFleetAgents,
|
||||
deleteAllDocsFromIndex,
|
||||
bulkIndex,
|
||||
deleteAllDocsFromMetadataCurrentIndex,
|
||||
deleteAllDocsFromMetadataDatastream,
|
||||
startTransform,
|
||||
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<IndexedHostsAndAlertsResponse> => {
|
||||
// generate an endpoint policy and attach id to agents since
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue