From a35761ff699786cd275f27e6315553af3a9aedd3 Mon Sep 17 00:00:00 2001 From: spalger Date: Mon, 11 May 2020 10:04:52 -0700 Subject: [PATCH 1/2] [uptime/usage-collector] add missing await --- .../server/lib/adapters/telemetry/kibana_telemetry_adapter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 } } }; From 62450bb46ba4667ed75f1e8d9cdff5a8b85b7cd8 Mon Sep 17 00:00:00 2001 From: spalger Date: Mon, 11 May 2020 12:52:41 -0700 Subject: [PATCH 2/2] stub method to avoid test failures --- .../telemetry/__tests__/kibana_telemetry_adapter.test.ts | 4 ++++ 1 file changed, 4 insertions(+) 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;