From e419ab90a3559f75763ab7bb4dfc7d1dd6ecc1e1 Mon Sep 17 00:00:00 2001 From: Spencer Date: Tue, 12 May 2020 14:45:12 -0700 Subject: [PATCH] [uptime/usage-collector] add missing await (#66079) --- .../telemetry/__tests__/kibana_telemetry_adapter.test.ts | 4 ++++ .../server/lib/adapters/telemetry/kibana_telemetry_adapter.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/uptime/server/lib/adapters/telemetry/__tests__/kibana_telemetry_adapter.test.ts b/x-pack/plugins/uptime/server/lib/adapters/telemetry/__tests__/kibana_telemetry_adapter.test.ts index c2437dbf35307..544b976bb5ffa 100644 --- a/x-pack/plugins/uptime/server/lib/adapters/telemetry/__tests__/kibana_telemetry_adapter.test.ts +++ b/x-pack/plugins/uptime/server/lib/adapters/telemetry/__tests__/kibana_telemetry_adapter.test.ts @@ -6,6 +6,10 @@ import { KibanaTelemetryAdapter } from '../kibana_telemetry_adapter'; +jest + .spyOn(KibanaTelemetryAdapter, 'countNoOfUniqueMonitorAndLocations') + .mockResolvedValue(undefined as any); + describe('KibanaTelemetryAdapter', () => { let usageCollection: any; let getSavedObjectsClient: any; diff --git a/x-pack/plugins/uptime/server/lib/adapters/telemetry/kibana_telemetry_adapter.ts b/x-pack/plugins/uptime/server/lib/adapters/telemetry/kibana_telemetry_adapter.ts index fa792429f102e..8ce2fb66b510a 100644 --- a/x-pack/plugins/uptime/server/lib/adapters/telemetry/kibana_telemetry_adapter.ts +++ b/x-pack/plugins/uptime/server/lib/adapters/telemetry/kibana_telemetry_adapter.ts @@ -44,7 +44,7 @@ export class KibanaTelemetryAdapter { fetch: async (callCluster: APICaller) => { const savedObjectsClient = getSavedObjectsClient()!; if (savedObjectsClient) { - this.countNoOfUniqueMonitorAndLocations(callCluster, savedObjectsClient); + await this.countNoOfUniqueMonitorAndLocations(callCluster, savedObjectsClient); } const report = this.getReport(); return { last_24_hours: { hits: { ...report } } };