Skip to content

Commit 9c59e4e

Browse files
committed
test(aerospike): close agent between config suites
The Aerospike spec loaded a fresh mock agent for the default and custom-service suites but only closed one listener after the whole version block. The next load could inherit overlapping tracer URL state and drop the second version's command spans.\n\nPair each agent.load with its own close, and use the tracer returned by that load for peer-service and naming-schema helpers.
1 parent fd17aa8 commit 9c59e4e

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

packages/datadog-plugin-aerospike/test/index.spec.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ describe('Plugin', () => {
2525

2626
withVersions('aerospike', 'aerospike', version => {
2727
beforeEach(() => {
28-
tracer = require('../../dd-trace')
2928
aerospike = require(`../../../versions/aerospike@${version}`).get()
3029
})
3130

@@ -43,18 +42,15 @@ describe('Plugin', () => {
4342
keyString = `${ns}:${set}:${userKey}`
4443
})
4544

46-
after(() => {
47-
return agent.close()
48-
})
49-
5045
describe('without configuration', () => {
51-
before(function () {
46+
before(async function () {
5247
this.timeout(10_000)
53-
return agent.load('aerospike')
48+
tracer = await agent.load('aerospike')
5449
})
5550

5651
after(() => {
5752
aerospike?.releaseEventLoop()
53+
return agent.close()
5854
})
5955

6056
describe('client', () => {
@@ -304,13 +300,14 @@ describe('Plugin', () => {
304300
})
305301

306302
describe('with configuration', () => {
307-
before(function () {
303+
before(async function () {
308304
this.timeout(10_000)
309-
return agent.load('aerospike', { service: 'custom' })
305+
tracer = await agent.load('aerospike', { service: 'custom' })
310306
})
311307

312308
after(() => {
313309
aerospike?.releaseEventLoop()
310+
return agent.close()
314311
})
315312

316313
it('should be configured with the correct values', done => {

0 commit comments

Comments
 (0)