From e3f0afa4e0e3d5ecf5c5a4eb954559130cd71d11 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Wed, 12 May 2021 15:21:22 -0400 Subject: [PATCH] Move functional tests off of legacy es client. (#99801) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- x-pack/test/api_integration/apis/uptime/rest/certs.ts | 4 ++-- .../api_integration/apis/uptime/rest/helper/make_checks.ts | 7 ++++--- .../apis/uptime/rest/monitor_states_generated.ts | 6 +++--- x-pack/test/api_integration/apis/uptime/rest/snapshot.ts | 2 +- .../apis/uptime/rest/telemetry_collectors.ts | 2 +- x-pack/test/functional/apps/uptime/locations.ts | 2 +- x-pack/test/functional/apps/uptime/ping_redirects.ts | 2 +- 7 files changed, 13 insertions(+), 12 deletions(-) diff --git a/x-pack/test/api_integration/apis/uptime/rest/certs.ts b/x-pack/test/api_integration/apis/uptime/rest/certs.ts index 76be0af03e90..d7c0a4eed4a7 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/certs.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/certs.ts @@ -15,7 +15,7 @@ import { makeChecksWithStatus } from './helper/make_checks'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const legacyEsService = getService('legacyEs'); + const esService = getService('es'); const esArchiver = getService('esArchiver'); describe('certs api', () => { @@ -33,7 +33,7 @@ export default function ({ getService }: FtrProviderContext) { const monitorId = 'monitor1'; before(async () => { makeChecksWithStatus( - legacyEsService, + esService, monitorId, 3, 1, diff --git a/x-pack/test/api_integration/apis/uptime/rest/helper/make_checks.ts b/x-pack/test/api_integration/apis/uptime/rest/helper/make_checks.ts index 829ae07eccf2..51338d2bb6e0 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/helper/make_checks.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/helper/make_checks.ts @@ -7,11 +7,12 @@ import uuid from 'uuid'; import { merge, flattenDeep } from 'lodash'; +import { KibanaClient } from '@elastic/elasticsearch/api/kibana'; import { makePing } from './make_ping'; import { TlsProps } from './make_tls'; interface CheckProps { - es: any; + es: KibanaClient; monitorId?: string; numIps?: number; fields?: { [key: string]: any }; @@ -76,7 +77,7 @@ export const makeCheck = async ({ }; export const makeChecks = async ( - es: any, + es: KibanaClient, monitorId: string, numChecks: number = 1, numIps: number = 1, @@ -121,7 +122,7 @@ export const makeChecks = async ( }; export const makeChecksWithStatus = async ( - es: any, + es: KibanaClient, monitorId: string, numChecks: number, numIps: number, diff --git a/x-pack/test/api_integration/apis/uptime/rest/monitor_states_generated.ts b/x-pack/test/api_integration/apis/uptime/rest/monitor_states_generated.ts index abd3c5d51928..5268a2146d12 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/monitor_states_generated.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/monitor_states_generated.ts @@ -36,7 +36,7 @@ export default function ({ getService }: FtrProviderContext) { describe('checks with no summaries', async () => { const testMonitorId = 'scope-test-id'; before(async () => { - const es = getService('legacyEs'); + const es = getService('es'); dateRangeStart = new Date().toISOString(); await makeChecksWithStatus(es, testMonitorId, 1, numIps, 1, {}, 'up', (d) => { delete d.summary; @@ -64,7 +64,7 @@ export default function ({ getService }: FtrProviderContext) { }; before(async () => { - const es = getService('legacyEs'); + const es = getService('es'); dateRangeStart = new Date().toISOString(); checks = await makeChecksWithStatus(es, testMonitorId, 1, numIps, 1, {}, 'up', (d) => { // turn an all up status into having at least one down @@ -141,7 +141,7 @@ export default function ({ getService }: FtrProviderContext) { before('generate three monitors with up, down, mix state', async () => { await getService('esArchiver').load('uptime/blank'); - const es = getService('legacyEs'); + const es = getService('es'); const observer = { geo: { diff --git a/x-pack/test/api_integration/apis/uptime/rest/snapshot.ts b/x-pack/test/api_integration/apis/uptime/rest/snapshot.ts index 7a5487c61161..358e667bcb05 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/snapshot.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/snapshot.ts @@ -52,7 +52,7 @@ export default function ({ getService }: FtrProviderContext) { const makeMonitorChecks = async (monitorId: string, status: 'up' | 'down') => { return makeChecksWithStatus( - getService('legacyEs'), + getService('es'), monitorId, checksPerMonitor, numIps, diff --git a/x-pack/test/api_integration/apis/uptime/rest/telemetry_collectors.ts b/x-pack/test/api_integration/apis/uptime/rest/telemetry_collectors.ts index f0f7a520d098..fd8894d7e916 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/telemetry_collectors.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/telemetry_collectors.ts @@ -12,7 +12,7 @@ import { makeChecksWithStatus } from './helper/make_checks'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const es = getService('legacyEs'); + const es = getService('es'); describe('telemetry collectors heartbeat', () => { before('generating data', async () => { diff --git a/x-pack/test/functional/apps/uptime/locations.ts b/x-pack/test/functional/apps/uptime/locations.ts index e3f1d0464075..1e71607845ea 100644 --- a/x-pack/test/functional/apps/uptime/locations.ts +++ b/x-pack/test/functional/apps/uptime/locations.ts @@ -11,7 +11,7 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default ({ getPageObjects, getService }: FtrProviderContext) => { const { uptime: uptimePage } = getPageObjects(['uptime']); const uptime = getService('uptime'); - const es = getService('legacyEs'); + const es = getService('es'); const monitor = () => uptime.monitor; const MONITOR_ID = 'location-testing-id'; diff --git a/x-pack/test/functional/apps/uptime/ping_redirects.ts b/x-pack/test/functional/apps/uptime/ping_redirects.ts index 9c39ed701772..39d9292dbbbb 100644 --- a/x-pack/test/functional/apps/uptime/ping_redirects.ts +++ b/x-pack/test/functional/apps/uptime/ping_redirects.ts @@ -35,7 +35,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { beforeEach(async () => { await makeChecksWithStatus( - getService('legacyEs'), + getService('es'), MONITOR_ID, 5, 2,