@@ -5,7 +5,7 @@ const os = require('os')
5
5
const { assert } = require ( 'chai' )
6
6
const { pollInterval, setup } = require ( './utils' )
7
7
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' )
9
9
const { version } = require ( '../../package.json' )
10
10
11
11
describe ( 'Dynamic Instrumentation' , function ( ) {
@@ -37,6 +37,10 @@ describe('Dynamic Instrumentation', function () {
37
37
} ]
38
38
39
39
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
+
40
44
assert . strictEqual ( id , t . rcConfig . id )
41
45
assert . strictEqual ( version , 1 )
42
46
assert . strictEqual ( state , ACKNOWLEDGED )
@@ -101,6 +105,10 @@ describe('Dynamic Instrumentation', function () {
101
105
]
102
106
103
107
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
+
104
112
assert . strictEqual ( id , t . rcConfig . id )
105
113
assert . strictEqual ( version , ++ receivedAckUpdates )
106
114
assert . strictEqual ( state , ACKNOWLEDGED )
@@ -141,6 +149,10 @@ describe('Dynamic Instrumentation', function () {
141
149
} ]
142
150
143
151
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
+
144
156
assert . strictEqual ( id , t . rcConfig . id )
145
157
assert . strictEqual ( version , 1 )
146
158
assert . strictEqual ( state , ACKNOWLEDGED )
0 commit comments