From 375c8114b68a80df40437b7f6c4f370948ce1926 Mon Sep 17 00:00:00 2001 From: Thomas Hunter II Date: Thu, 29 Jun 2023 06:32:23 -0700 Subject: [PATCH] pg: update error string comparison in test (#3295) --- packages/datadog-plugin-pg/test/index.spec.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/datadog-plugin-pg/test/index.spec.js b/packages/datadog-plugin-pg/test/index.spec.js index 59cad83260f..27a4bb01dea 100644 --- a/packages/datadog-plugin-pg/test/index.spec.js +++ b/packages/datadog-plugin-pg/test/index.spec.js @@ -153,7 +153,12 @@ describe('Plugin', () => { agent.use(traces => { expect(traces[0][0].meta).to.have.property(ERROR_TYPE, error.name) expect(traces[0][0].meta).to.have.property(ERROR_MESSAGE, error.message) - expect(traces[0][0].meta).to.have.property(ERROR_STACK, error.stack) + + // pg modifies stacktraces as of v8.11.1 + const actualErrorNoStack = traces[0][0].meta[ERROR_STACK].split('\n')[0] + const expectedErrorNoStack = error.stack.split('\n')[0] + expect(actualErrorNoStack).to.eql(expectedErrorNoStack) + expect(traces[0][0].meta).to.have.property('component', 'pg') expect(traces[0][0].metrics).to.have.property('network.destination.port', 5432) })