Skip to content

Commit e7fd29a

Browse files
committed
test: speed up DI tests
Increase the RC poll interval in the Dynamic Instrumentation integration tests, so that they run faster.
1 parent 7e78aaa commit e7fd29a

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

integration-tests/debugger/basic.spec.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const os = require('os')
55
const { assert } = require('chai')
66
const { pollInterval, setup } = require('./utils')
77
const { assertObjectContains, assertUUID } = require('../helpers')
8-
const { ACKNOWLEDGED, ERROR } = require('../../packages/dd-trace/src/remote_config/apply_states')
8+
const { UNACKNOWLEDGED, ACKNOWLEDGED, ERROR } = require('../../packages/dd-trace/src/remote_config/apply_states')
99
const { version } = require('../../package.json')
1010

1111
describe('Dynamic Instrumentation', function () {
@@ -37,6 +37,10 @@ describe('Dynamic Instrumentation', function () {
3737
}]
3838

3939
t.agent.on('remote-config-ack-update', (id, version, state, error) => {
40+
// Due to the very short DD_REMOTE_CONFIG_POLL_INTERVAL_SECONDS, there's a race condition in which we might
41+
// get an UNACKNOWLEDGED state first before the ACKNOWLEDGED state.
42+
if (state === UNACKNOWLEDGED) return
43+
4044
assert.strictEqual(id, t.rcConfig.id)
4145
assert.strictEqual(version, 1)
4246
assert.strictEqual(state, ACKNOWLEDGED)
@@ -101,6 +105,10 @@ describe('Dynamic Instrumentation', function () {
101105
]
102106

103107
t.agent.on('remote-config-ack-update', (id, version, state, error) => {
108+
// Due to the very short DD_REMOTE_CONFIG_POLL_INTERVAL_SECONDS, there's a race condition in which we might
109+
// get an UNACKNOWLEDGED state first before the ACKNOWLEDGED state.
110+
if (state === UNACKNOWLEDGED) return
111+
104112
assert.strictEqual(id, t.rcConfig.id)
105113
assert.strictEqual(version, ++receivedAckUpdates)
106114
assert.strictEqual(state, ACKNOWLEDGED)
@@ -141,6 +149,10 @@ describe('Dynamic Instrumentation', function () {
141149
}]
142150

143151
t.agent.on('remote-config-ack-update', (id, version, state, error) => {
152+
// Due to the very short DD_REMOTE_CONFIG_POLL_INTERVAL_SECONDS, there's a race condition in which we might
153+
// get an UNACKNOWLEDGED state first before the ACKNOWLEDGED state.
154+
if (state === UNACKNOWLEDGED) return
155+
144156
assert.strictEqual(id, t.rcConfig.id)
145157
assert.strictEqual(version, 1)
146158
assert.strictEqual(state, ACKNOWLEDGED)

integration-tests/debugger/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const { createSandbox, FakeAgent, spawnProc } = require('../helpers')
1010
const { generateProbeConfig } = require('../../packages/dd-trace/test/debugger/devtools_client/utils')
1111

1212
const BREAKPOINT_TOKEN = '// BREAKPOINT'
13-
const pollInterval = 1
13+
const pollInterval = 0.1
1414

1515
module.exports = {
1616
pollInterval,

0 commit comments

Comments
 (0)