@@ -8,12 +8,14 @@ const {
88 useSandbox,
99 checkSpansForServiceName,
1010 spawnPluginIntegrationTestProcAndExpectExit,
11+ varySandbox,
1112} = require ( '../../../../integration-tests/helpers' )
1213const { withVersions } = require ( '../../../dd-trace/test/setup/mocha' )
1314
1415describe ( 'esm' , ( ) => {
1516 let agent
1617 let proc
18+ let variants
1719
1820 withVersions ( 'bullmq' , 'bullmq' , '>=5.66.0' , version => {
1921 useSandbox ( [ `'bullmq@${ version } '` ] , false , [
@@ -29,69 +31,93 @@ describe('esm', () => {
2931 } )
3032
3133 describe ( 'Queue.add()' , ( ) => {
32- it ( 'is instrumented' , async ( ) => {
33- const res = agent . assertMessageReceived ( ( { headers, payload } ) => {
34- assert . strictEqual ( headers . host , `127.0.0.1:${ agent . port } ` )
35- assert . ok ( Array . isArray ( payload ) )
36- assert . strictEqual ( checkSpansForServiceName ( payload , 'bullmq.add' ) , true )
37- } )
38-
39- proc = await spawnPluginIntegrationTestProcAndExpectExit ( sandboxCwd ( ) , 'server-queue-add.mjs' , agent . port )
40-
41- await res
42- } ) . timeout ( 60000 )
34+ beforeEach ( async ( ) => {
35+ variants = varySandbox ( 'server-queue-add.mjs' , 'bullmq' , 'Queue' )
36+ } )
37+
38+ for ( const variant of varySandbox . VARIANTS ) {
39+ it ( `is instrumented ${ variant } ` , async ( ) => {
40+ const res = agent . assertMessageReceived ( ( { headers, payload } ) => {
41+ assert . strictEqual ( headers . host , `127.0.0.1:${ agent . port } ` )
42+ assert . ok ( Array . isArray ( payload ) )
43+ assert . strictEqual ( checkSpansForServiceName ( payload , 'bullmq.add' ) , true )
44+ } )
45+
46+ proc = await spawnPluginIntegrationTestProcAndExpectExit ( sandboxCwd ( ) , variants [ variant ] , agent . port )
47+
48+ await res
49+ } ) . timeout ( 60000 )
50+ }
4351 } )
4452
4553 describe ( 'Queue.addBulk()' , ( ) => {
46- it ( 'is instrumented' , async ( ) => {
47- const res = agent . assertMessageReceived ( ( { headers, payload } ) => {
48- assert . strictEqual ( headers . host , `127.0.0.1:${ agent . port } ` )
49- assert . ok ( Array . isArray ( payload ) )
50- assert . strictEqual ( checkSpansForServiceName ( payload , 'bullmq.addBulk' ) , true )
51- } )
52-
53- proc = await spawnPluginIntegrationTestProcAndExpectExit ( sandboxCwd ( ) , 'server-queue-add-bulk.mjs' , agent . port )
54-
55- await res
56- } ) . timeout ( 60000 )
54+ beforeEach ( async ( ) => {
55+ variants = varySandbox ( 'server-queue-add-bulk.mjs' , 'bullmq' , 'Queue' )
56+ } )
57+
58+ for ( const variant of varySandbox . VARIANTS ) {
59+ it ( `is instrumented ${ variant } ` , async ( ) => {
60+ const res = agent . assertMessageReceived ( ( { headers, payload } ) => {
61+ assert . strictEqual ( headers . host , `127.0.0.1:${ agent . port } ` )
62+ assert . ok ( Array . isArray ( payload ) )
63+ assert . strictEqual ( checkSpansForServiceName ( payload , 'bullmq.addBulk' ) , true )
64+ } )
65+
66+ proc = await spawnPluginIntegrationTestProcAndExpectExit ( sandboxCwd ( ) , variants [ variant ] , agent . port )
67+
68+ await res
69+ } ) . timeout ( 60000 )
70+ }
5771 } )
5872
5973 describe ( 'FlowProducer.add()' , ( ) => {
60- it ( 'is instrumented' , async ( ) => {
61- const res = agent . assertMessageReceived ( ( { headers, payload } ) => {
62- assert . strictEqual ( headers . host , `127.0.0.1:${ agent . port } ` )
63- assert . ok ( Array . isArray ( payload ) )
64- assert . strictEqual ( checkSpansForServiceName ( payload , 'bullmq.add' ) , true )
65- } )
66-
67- proc = await spawnPluginIntegrationTestProcAndExpectExit (
68- sandboxCwd ( ) ,
69- 'server-flow-producer-add.mjs' ,
70- agent . port
71- )
72-
73- await res
74- } ) . timeout ( 60000 )
74+ beforeEach ( async ( ) => {
75+ variants = varySandbox ( 'server-flow-producer-add.mjs' , 'bullmq' , 'FlowProducer' )
76+ } )
77+
78+ for ( const variant of varySandbox . VARIANTS ) {
79+ it ( `is instrumented ${ variant } ` , async ( ) => {
80+ const res = agent . assertMessageReceived ( ( { headers, payload } ) => {
81+ assert . strictEqual ( headers . host , `127.0.0.1:${ agent . port } ` )
82+ assert . ok ( Array . isArray ( payload ) )
83+ assert . strictEqual ( checkSpansForServiceName ( payload , 'bullmq.add' ) , true )
84+ } )
85+
86+ proc = await spawnPluginIntegrationTestProcAndExpectExit (
87+ sandboxCwd ( ) ,
88+ variants [ variant ] ,
89+ agent . port
90+ )
91+
92+ await res
93+ } ) . timeout ( 60000 )
94+ }
7595 } )
7696
7797 describe ( 'Worker.callProcessJob()' , ( ) => {
78- it ( 'is instrumented' , async ( ) => {
79- const res = agent . assertMessageReceived ( ( { headers, payload } ) => {
80- assert . strictEqual ( headers . host , `127.0.0.1:${ agent . port } ` )
81- assert . ok ( Array . isArray ( payload ) )
82- assert . strictEqual ( checkSpansForServiceName ( payload , 'bullmq.processJob' ) , true )
83- } )
84-
85- proc = await spawnPluginIntegrationTestProcAndExpectExit (
86- sandboxCwd ( ) ,
87- 'server-worker-process-job.mjs' ,
88- agent . port ,
89- // Disable Redis/ioredis instrumentation to avoid hitting max active requests limit
90- { DD_TRACE_REDIS_ENABLED : 'false' , DD_TRACE_IOREDIS_ENABLED : 'false' }
91- )
92-
93- await res
94- } ) . timeout ( 60000 )
98+ beforeEach ( async ( ) => {
99+ variants = varySandbox ( 'server-worker-process-job.mjs' , 'bullmq' , 'Queue, Worker, QueueEvents' )
100+ } )
101+
102+ for ( const variant of varySandbox . VARIANTS ) {
103+ it ( `is instrumented ${ variant } ` , async ( ) => {
104+ const res = agent . assertMessageReceived ( ( { headers, payload } ) => {
105+ assert . strictEqual ( headers . host , `127.0.0.1:${ agent . port } ` )
106+ assert . ok ( Array . isArray ( payload ) )
107+ assert . strictEqual ( checkSpansForServiceName ( payload , 'bullmq.processJob' ) , true )
108+ } )
109+
110+ proc = await spawnPluginIntegrationTestProcAndExpectExit (
111+ sandboxCwd ( ) ,
112+ variants [ variant ] ,
113+ agent . port ,
114+ // Disable Redis/ioredis instrumentation to avoid hitting max active requests limit
115+ { DD_TRACE_REDIS_ENABLED : 'false' , DD_TRACE_IOREDIS_ENABLED : 'false' }
116+ )
117+
118+ await res
119+ } ) . timeout ( 60000 )
120+ }
95121 } )
96122 } )
97123} )
0 commit comments