Skip to content

Commit cb90123

Browse files
committed
Reinstated flushInterval for prisma and azure ESM tests
1 parent db50431 commit cb90123

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

integration-tests/helpers/fake-agent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ module.exports = class FakeAgent extends EventEmitter {
123123
// where multiple payloads are generated, and only one is expected to have the proper span (ie next.request),
124124
// but it't not guaranteed to be the last one (so, expectedMessageCount would not be helpful).
125125
// It can still fail if it takes longer than `timeout` duration or if none pass the assertions (timeout still called)
126-
assertMessageReceived (fn, timeout, expectedMessageCount = 1, resolveAtFirstSuccess = 1) {
126+
assertMessageReceived (fn, timeout, expectedMessageCount = 1, resolveAtFirstSuccess = true) {
127127
timeout = timeout || 30000
128128
let resultResolve
129129
let resultReject

packages/datadog-plugin-azure-event-hubs/test/integration-test/client.spec.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ const {
99
const { withVersions } = require('../../../dd-trace/test/setup/mocha')
1010
const { assert, expect } = require('chai')
1111

12+
const spawnEnv = { DD_TRACE_FLUSH_INTERVAL: '2000' }
13+
1214
describe('esm', () => {
1315
let agent
1416
let proc
@@ -42,7 +44,7 @@ describe('esm', () => {
4244
assert.strictEqual(checkSpansForServiceName(payload, 'azure.eventhubs.send'), true)
4345
})
4446

45-
proc = await spawnPluginIntegrationTestProc(sandbox.folder, 'server.mjs', agent.port)
47+
proc = await spawnPluginIntegrationTestProc(sandbox.folder, 'server.mjs', agent.port, spawnEnv)
4648
await res
4749
}).timeout(20000)
4850

@@ -86,15 +88,15 @@ describe('esm', () => {
8688
assert.strictEqual(parseLinks(payload[4][0]).length, 2)
8789
})
8890

89-
proc = await spawnPluginIntegrationTestProc(sandbox.folder, 'server.mjs', agent.port)
91+
proc = await spawnPluginIntegrationTestProc(sandbox.folder, 'server.mjs', agent.port, spawnEnv)
9092
await res
9193
}).timeout(60000)
9294

9395
it('does not add span links when they are disabled', async () => {
9496
const res = agent.assertMessageReceived(({ headers, payload }) => {
9597
expect(payload[2][0]).to.not.have.property('_dd.span_links')
9698
})
97-
const envVar = { DD_TRACE_AZURE_EVENTHUBS_BATCH_LINKS_ENABLED: false }
99+
const envVar = { DD_TRACE_AZURE_EVENTHUBS_BATCH_LINKS_ENABLED: false, DD_TRACE_FLUSH_INTERVAL: '2000' }
98100
proc = await spawnPluginIntegrationTestProc(sandbox.folder, 'server.mjs', agent.port, undefined, envVar)
99101
await res
100102
}).timeout(60000)

packages/datadog-plugin-azure-service-bus/test/integration-test/client.spec.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ const {
88
const { withVersions } = require('../../../dd-trace/test/setup/mocha')
99
const { assert } = require('chai')
1010

11+
const spawnEnv = { DD_TRACE_FLUSH_INTERVAL: '2000' }
12+
1113
describe('esm', () => {
1214
let agent
1315
let proc
@@ -40,7 +42,7 @@ describe('esm', () => {
4042
assert.isArray(payload)
4143
})
4244

43-
proc = await spawnPluginIntegrationTestProc(sandbox.folder, 'server.mjs', agent.port)
45+
proc = await spawnPluginIntegrationTestProc(sandbox.folder, 'server.mjs', agent.port, spawnEnv)
4446

4547
await res
4648
}).timeout(20000)
@@ -151,7 +153,7 @@ describe('esm', () => {
151153
assert.strictEqual(parseLinks(payload[22][0]).length, 2)
152154
})
153155

154-
proc = await spawnPluginIntegrationTestProc(sandbox.folder, 'server.mjs', agent.port)
156+
proc = await spawnPluginIntegrationTestProc(sandbox.folder, 'server.mjs', agent.port, spawnEnv)
155157

156158
await res
157159
}).timeout(60000)

packages/datadog-plugin-prisma/test/integration-test/client.spec.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ describe('esm', () => {
7272
// TODO: Integrate the assertions into the spawn command by adding a
7373
// callback. It should end the process when the assertions are met. That
7474
// way we can remove the Promise.all and the procPromise.then().
75-
const procPromise = spawnPluginIntegrationTestProc(sandbox.folder, 'server.mjs', agent.port)
75+
const procPromise = spawnPluginIntegrationTestProc(sandbox.folder, 'server.mjs', agent.port, {
76+
DD_TRACE_FLUSH_INTERVAL: '2000'
77+
})
7678

7779
await Promise.all([
7880
procPromise.then((res) => {

0 commit comments

Comments
 (0)