11import { describe , expect , test } from 'vitest' ;
22import { createRunner } from '../../../utils/runner' ;
3+ import { conditionalTest } from '../../../utils' ;
34
45describe ( 'postgres auto instrumentation' , ( ) => {
56 test ( 'should auto-instrument `pg` package' , { timeout : 90_000 } , async ( ) => {
@@ -49,7 +50,6 @@ describe('postgres auto instrumentation', () => {
4950 await createRunner ( __dirname , 'scenario.js' )
5051 . withDockerCompose ( {
5152 workingDirectory : [ __dirname ] ,
52- setupCommand : 'yarn' ,
5353 } )
5454 . expect ( { transaction : EXPECTED_TRANSACTION } )
5555 . start ( )
@@ -60,7 +60,6 @@ describe('postgres auto instrumentation', () => {
6060 await createRunner ( __dirname , 'scenario-ignoreConnect.js' )
6161 . withDockerCompose ( {
6262 workingDirectory : [ __dirname ] ,
63- setupCommand : 'yarn' ,
6463 } )
6564 . expect ( {
6665 transaction : txn => {
@@ -103,57 +102,59 @@ describe('postgres auto instrumentation', () => {
103102 . completed ( ) ;
104103 } ) ;
105104
106- test ( 'should auto-instrument `pg-native` package' , { timeout : 90_000 } , async ( ) => {
107- const EXPECTED_TRANSACTION = {
108- transaction : 'Test Transaction' ,
109- spans : expect . arrayContaining ( [
110- expect . objectContaining ( {
111- data : expect . objectContaining ( {
112- 'db.system' : 'postgresql' ,
113- 'db.name' : 'tests' ,
114- 'sentry.origin' : 'manual' ,
115- 'sentry.op' : 'db' ,
105+ conditionalTest ( { max : 25 } ) ( 'pg-native' , ( ) => {
106+ test ( 'should auto-instrument `pg-native` package' , { timeout : 90_000 } , async ( ) => {
107+ const EXPECTED_TRANSACTION = {
108+ transaction : 'Test Transaction' ,
109+ spans : expect . arrayContaining ( [
110+ expect . objectContaining ( {
111+ data : expect . objectContaining ( {
112+ 'db.system' : 'postgresql' ,
113+ 'db.name' : 'tests' ,
114+ 'sentry.origin' : 'manual' ,
115+ 'sentry.op' : 'db' ,
116+ } ) ,
117+ description : 'pg.connect' ,
118+ op : 'db' ,
119+ status : 'ok' ,
116120 } ) ,
117- description : 'pg.connect' ,
118- op : 'db' ,
119- status : 'ok' ,
120- } ) ,
121- expect . objectContaining ( {
122- data : expect . objectContaining ( {
123- 'db.system' : 'postgresql' ,
124- 'db.name' : 'tests' ,
125- 'db.statement' : 'INSERT INTO "NativeUser" ("email", "name") VALUES ($1, $2)' ,
126- 'sentry.origin' : 'auto.db.otel.postgres' ,
127- 'sentry.op' : 'db' ,
121+ expect . objectContaining ( {
122+ data : expect . objectContaining ( {
123+ 'db.system' : 'postgresql' ,
124+ 'db.name' : 'tests' ,
125+ 'db.statement' : 'INSERT INTO "NativeUser" ("email", "name") VALUES ($1, $2)' ,
126+ 'sentry.origin' : 'auto.db.otel.postgres' ,
127+ 'sentry.op' : 'db' ,
128+ } ) ,
129+ description : 'INSERT INTO "NativeUser" ("email", "name") VALUES ($1, $2)' ,
130+ op : 'db' ,
131+ status : 'ok' ,
132+ origin : 'auto.db.otel.postgres' ,
128133 } ) ,
129- description : 'INSERT INTO "NativeUser" ("email", "name") VALUES ($1, $2)' ,
130- op : 'db' ,
131- status : 'ok ' ,
132- origin : 'auto. db.otel.postgres ',
133- } ) ,
134- expect . objectContaining ( {
135- data : expect . objectContaining ( {
136- 'db.system' : 'postgresql' ,
137- 'db.name' : 'tests ' ,
138- 'db.statement' : 'SELECT * FROM "NativeUser" ' ,
139- 'sentry.origin' : 'auto.db.otel.postgres ' ,
140- 'sentry.op' : 'db ' ,
134+ expect . objectContaining ( {
135+ data : expect . objectContaining ( {
136+ 'db.system' : 'postgresql ' ,
137+ ' db.name' : 'tests ',
138+ 'db.statement' : 'SELECT * FROM "NativeUser"' ,
139+ 'sentry.origin' : 'auto.db.otel.postgres' ,
140+ 'sentry.op' : 'db' ,
141+ } ) ,
142+ description : 'SELECT * FROM "NativeUser" ' ,
143+ op : 'db ' ,
144+ status : 'ok ' ,
145+ origin : 'auto.db.otel.postgres ' ,
141146 } ) ,
142- description : 'SELECT * FROM "NativeUser"' ,
143- op : 'db' ,
144- status : 'ok' ,
145- origin : 'auto.db.otel.postgres' ,
146- } ) ,
147- ] ) ,
148- } ;
147+ ] ) ,
148+ } ;
149149
150- await createRunner ( __dirname , 'scenario-native.js' )
151- . withDockerCompose ( {
152- workingDirectory : [ __dirname ] ,
153- setupCommand : 'yarn' ,
154- } )
155- . expect ( { transaction : EXPECTED_TRANSACTION } )
156- . start ( )
157- . completed ( ) ;
150+ await createRunner ( __dirname , 'scenario-native.js' )
151+ . withDockerCompose ( {
152+ workingDirectory : [ __dirname ] ,
153+ setupCommand : 'yarn' ,
154+ } )
155+ . expect ( { transaction : EXPECTED_TRANSACTION } )
156+ . start ( )
157+ . completed ( ) ;
158+ } ) ;
158159 } ) ;
159160} ) ;
0 commit comments