From 7f210a7cb2de2a2de4b9902870e45f6ce3eaee02 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 } } };