From 08b66fb8bf94cd374c6ec2c1efa60991621d3383 Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Tue, 31 May 2022 22:02:05 +0900 Subject: [PATCH] Hacking around test failures --- x-pack/plugins/alerting/jest.config.js | 2 +- .../alerting/server/monitoring/in_memory_metrics.test.ts | 2 ++ x-pack/plugins/alerting/server/monitoring/in_memory_metrics.ts | 2 +- x-pack/plugins/alerting/server/task_runner/task_runner.ts | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/alerting/jest.config.js b/x-pack/plugins/alerting/jest.config.js index 05db974299b40..257dbcd2cddd9 100644 --- a/x-pack/plugins/alerting/jest.config.js +++ b/x-pack/plugins/alerting/jest.config.js @@ -6,7 +6,7 @@ */ module.exports = { - preset: '@kbn/test', + preset: '@kbn/test/jest_node', rootDir: '../../..', roots: ['/x-pack/plugins/alerting'], coverageDirectory: '/target/kibana-coverage/jest/x-pack/plugins/alerting', diff --git a/x-pack/plugins/alerting/server/monitoring/in_memory_metrics.test.ts b/x-pack/plugins/alerting/server/monitoring/in_memory_metrics.test.ts index 6a139df0aa844..8cb410fb26011 100644 --- a/x-pack/plugins/alerting/server/monitoring/in_memory_metrics.test.ts +++ b/x-pack/plugins/alerting/server/monitoring/in_memory_metrics.test.ts @@ -8,6 +8,8 @@ import { InMemoryMetrics, IN_MEMORY_METRICS } from '.'; import { loggingSystemMock } from '@kbn/core/server/mocks'; +jest.useFakeTimers(); + describe('inMemoryMetrics', () => { const logger = loggingSystemMock.createLogger(); const inMemoryMetrics = new InMemoryMetrics(logger); diff --git a/x-pack/plugins/alerting/server/monitoring/in_memory_metrics.ts b/x-pack/plugins/alerting/server/monitoring/in_memory_metrics.ts index e5a941e69f2b9..5818230c877d5 100644 --- a/x-pack/plugins/alerting/server/monitoring/in_memory_metrics.ts +++ b/x-pack/plugins/alerting/server/monitoring/in_memory_metrics.ts @@ -33,7 +33,7 @@ export class InMemoryMetrics { constructor(logger: Logger) { this.logger = logger; - this.logger.debug('MATSCHAFFER: CREATING meter provider'); + // this.logger.debug('MATSCHAFFER: CREATING meter provider'); const provider = new MeterProvider({ exporter: new OTLPMetricExporter(), interval: 1000, diff --git a/x-pack/plugins/alerting/server/task_runner/task_runner.ts b/x-pack/plugins/alerting/server/task_runner/task_runner.ts index 8c8064ab75587..94d057f543453 100644 --- a/x-pack/plugins/alerting/server/task_runner/task_runner.ts +++ b/x-pack/plugins/alerting/server/task_runner/task_runner.ts @@ -797,7 +797,7 @@ export class TaskRunner< }; if (!this.cancelled) { - this.logger.debug("MATSCHAFFER: INCREMENTING rule's execution count"); + // this.logger.debug("MATSCHAFFER: INCREMENTING rule's execution count"); // this.inMemoryMetrics.increment(IN_MEMORY_METRICS.RULE_EXECUTIONS, { rule: this.ruleType.id }); this.inMemoryMetrics.increment(IN_MEMORY_METRICS.RULE_EXECUTIONS); if (executionStatus.error) {