From 2a6ea198395f32e199a158b65c02abe8ae5f6f0a Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Wed, 4 Oct 2023 07:04:31 -0700 Subject: [PATCH] tests: fix tests to work with recent elastic-apm-node that includes a log preamble (#148) Since elastic-apm-node@3.47.0 the APM agent will log.info a preamble with config and some other basic debugging info. This was breaking the APM-related tests. --- loggers/morgan/test/serve-one-http-req-with-apm.js | 5 +++-- loggers/pino/test/serve-one-http-req-with-apm.js | 5 +++-- loggers/winston/test/serve-one-http-req-with-apm.js | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/loggers/morgan/test/serve-one-http-req-with-apm.js b/loggers/morgan/test/serve-one-http-req-with-apm.js index 8ff23c2..3198460 100644 --- a/loggers/morgan/test/serve-one-http-req-with-apm.js +++ b/loggers/morgan/test/serve-one-http-req-with-apm.js @@ -36,8 +36,9 @@ const apm = require('elastic-apm-node').start({ serviceName: 'test-apm', centralConfig: false, captureExceptions: false, - metricsInterval: 0, - apmServerVersion: '8.2.0' // avoid APM server version check request + metricsInterval: '0s', + apmServerVersion: '8.9.0', // avoid APM server version check request + logLevel: 'warn' // avoid APM agent log preamble }) const app = require('express')() diff --git a/loggers/pino/test/serve-one-http-req-with-apm.js b/loggers/pino/test/serve-one-http-req-with-apm.js index ee71dde..ae46833 100644 --- a/loggers/pino/test/serve-one-http-req-with-apm.js +++ b/loggers/pino/test/serve-one-http-req-with-apm.js @@ -35,8 +35,9 @@ const apm = require('elastic-apm-node').start({ serviceName: 'test-apm', centralConfig: false, captureExceptions: false, - metricsInterval: 0, - apmServerVersion: '8.2.0' // avoid APM server version check request + metricsInterval: '0s', + apmServerVersion: '8.9.0', // avoid APM server version check request + logLevel: 'warn' // avoid APM agent log preamble }) const http = require('http') diff --git a/loggers/winston/test/serve-one-http-req-with-apm.js b/loggers/winston/test/serve-one-http-req-with-apm.js index 0c6cd4d..a4b047e 100644 --- a/loggers/winston/test/serve-one-http-req-with-apm.js +++ b/loggers/winston/test/serve-one-http-req-with-apm.js @@ -35,8 +35,9 @@ const apm = require('elastic-apm-node').start({ serviceName: 'test-apm', centralConfig: false, captureExceptions: false, - metricsInterval: 0, - apmServerVersion: '8.2.0' // avoid APM server version check request + metricsInterval: '0s', + apmServerVersion: '8.9.0', // avoid APM server version check request + logLevel: 'warn' // avoid APM agent log preamble }) const http = require('http')