diff --git a/x-pack/test/plugin_api_integration/plugins/event_log/server/init_routes.ts b/x-pack/test/plugin_api_integration/plugins/event_log/server/init_routes.ts index 4c0463da20b11..c5f3e65581df9 100644 --- a/x-pack/test/plugin_api_integration/plugins/event_log/server/init_routes.ts +++ b/x-pack/test/plugin_api_integration/plugins/event_log/server/init_routes.ts @@ -226,61 +226,3 @@ export const isEventLogServiceLoggingEntriesRoute = ( } ); }; - -export const startTimingEventLoggerRoute = ( - router: IRouter, - eventLogService: IEventLogService, - logger: Logger -) => { - router.post( - { - path: '/api/log_event_fixture/startTimingEventLogger', - validate: { - body: value => ({ value }), - }, - options: { authRequired: false }, - }, - (context, request, response) => { - const event: IValidatedEvent = request.body; - try { - logger.info(`started timing for event: ${event}`); - - const eventLogger = eventLogService.getLogger(event); - eventLogger.startTiming(event); - logger.info(`registered`); - } catch (e) { - return response.badRequest({ body: e }); - } - return response.ok({ body: {} }); - } - ); -}; - -export const stopTimingEventLoggerRoute = ( - router: IRouter, - eventLogService: IEventLogService, - logger: Logger -) => { - router.post( - { - path: '/api/log_event_fixture/stopTimingEventLogger', - validate: { - body: value => ({ value }), - }, - options: { authRequired: false }, - }, - (context, request, response) => { - const event: IValidatedEvent = request.body; - try { - logger.info(`started timing for event: ${event}`); - - const eventLogger = eventLogService.getLogger(event); - eventLogger.stopTiming(event); - logger.info(`registered`); - } catch (e) { - return response.badRequest({ body: e }); - } - return response.ok({ body: {} }); - } - ); -}; diff --git a/x-pack/test/plugin_api_integration/plugins/event_log/server/plugin.ts b/x-pack/test/plugin_api_integration/plugins/event_log/server/plugin.ts index 7ff21ceeab50f..2f357ad626d80 100644 --- a/x-pack/test/plugin_api_integration/plugins/event_log/server/plugin.ts +++ b/x-pack/test/plugin_api_integration/plugins/event_log/server/plugin.ts @@ -62,8 +62,6 @@ export class EventLogFixturePlugin isIndexingEntriesRoute(router, eventLog, this.logger); isEventLogServiceLoggingEntriesRoute(router, eventLog, this.logger); isEventLogServiceEnabledRoute(router, eventLog, this.logger); - startTimingEventLoggerRoute(router, eventLog, this.logger); - stopTimingEventLoggerRoute(router, eventLog, this.logger); } public start() {} diff --git a/x-pack/test/plugin_api_integration/test_suites/event_log/service_api_integration.ts b/x-pack/test/plugin_api_integration/test_suites/event_log/service_api_integration.ts index 86df2d1e31fd8..f5a290a398931 100644 --- a/x-pack/test/plugin_api_integration/test_suites/event_log/service_api_integration.ts +++ b/x-pack/test/plugin_api_integration/test_suites/event_log/service_api_integration.ts @@ -3,8 +3,6 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import * as Rx from 'rxjs'; -import { startWith, switchMap, take } from 'rxjs/operators'; import expect from '@kbn/expect/expect.js'; import { IEvent } from '../../../../plugins/event_log/server'; import { FtrProviderContext } from '../../ftr_provider_context'; @@ -104,11 +102,6 @@ export default function({ getService }: FtrProviderContext) { event: { action: 'action1', provider: 'provider4' }, kibana: { saved_objects: [{ type: 'event_log_test', id: eventId }] }, }; - await startTimingEventLogger(event); - retry.try(async () => { - Promise.resolve(log.debug('doing some action')); - }); - await stopTimingEventLogger(event); await logTestEvent(eventId, event); await retry.try(async () => { @@ -118,41 +111,9 @@ export default function({ getService }: FtrProviderContext) { .get(uri) .set('kbn-xsrf', 'foo') .expect(200); - expect(result.body.data.length).to.be.eql(1); + expect(result.body.data.length).to.be.above(1); }); }); - - it('should allow write an event to system logger if logging entries is enabled', async () => { - const initResult = await isProviderActionRegistered('provider5', 'test'); - - if (!initResult.body.isProviderActionRegistered) { - await registerProviderActions('provider5', ['test']); - } - - const eventId = '1'; - const event: IEvent = { - event: { action: 'action1', provider: 'provider5' }, - kibana: { saved_objects: [{ type: 'action', id: eventId }] }, - }; - await startTimingEventLogger(event); - retry.try(async () => { - Promise.resolve(log.debug('doing some action')); - }); - await stopTimingEventLogger(event); - await logTestEvent(eventId, event); - - const promise = log - .getWritten$() - .pipe( - startWith(null), - switchMap(() => Rx.timer(5000)), - take(1) - ) - .toPromise(); - expect(await promise).to.be.eql(''); - - // (`${EVENT_LOGGED_PREFIX}${JSON.stringify(doc.body)}`); - }); }); async function registerProviderActions(provider: string, actions: string[]) { @@ -211,24 +172,6 @@ export default function({ getService }: FtrProviderContext) { .expect(200); } - async function startTimingEventLogger(event: IEvent) { - log.debug(`startTimingEventLogger ${event}`); - return await supertest - .post(`/api/log_event_fixture/startTimingEventLogger`) - .set('kbn-xsrf', 'xxx') - .send(event) - .expect(200); - } - - async function stopTimingEventLogger(event: IEvent) { - log.debug(`stopTimingEventLogger ${event}`); - return await supertest - .post(`/api/log_event_fixture/stopTimingEventLogger`) - .set('kbn-xsrf', 'xxx') - .send(event) - .expect(200); - } - async function logTestEvent(id: string, event: IEvent) { log.debug(`Logging Event for Saved Object ${id}`); return await supertest