Skip to content

Commit 9271a0d

Browse files
committed
skip pg-native on node 26
1 parent 98b5777 commit 9271a0d

5 files changed

Lines changed: 82 additions & 57 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: '3.9'
2+
3+
services:
4+
db:
5+
image: postgres:13
6+
restart: always
7+
container_name: integration-tests-postgres
8+
ports:
9+
- '5494:5432'
10+
environment:
11+
POSTGRES_USER: test
12+
POSTGRES_PASSWORD: test
13+
POSTGRES_DB: tests
14+
healthcheck:
15+
test: ['CMD-SHELL', 'pg_isready -U test -d tests']
16+
interval: 2s
17+
timeout: 3s
18+
retries: 30
19+
start_period: 5s

dev-packages/node-integration-tests/suites/tracing/postgres/package.json renamed to dev-packages/node-integration-tests/suites/tracing/postgres/pg-native/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"author": "",
1111
"license": "ISC",
1212
"dependencies": {
13-
"pg": "8.16.0",
1413
"pg-native": "3.5.0"
1514
}
1615
}

dev-packages/node-integration-tests/suites/tracing/postgres/scenario-native.js renamed to dev-packages/node-integration-tests/suites/tracing/postgres/pg-native/scenario.js

File renamed without changes.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import { describe, expect, test } from 'vitest';
2+
import { createRunner } from '../../../../utils/runner';
3+
import { conditionalTest } from '../../../../utils';
4+
5+
describe('postgres pg-native auto instrumentation', () => {
6+
// TODO: pg-native is currently not supported on Node 26+
7+
// See e.g. https://github.com/brianc/node-postgres/pull/3667
8+
conditionalTest({ max: 25 })('pg-native', () => {
9+
test('should auto-instrument `pg-native` package', { timeout: 90_000 }, async () => {
10+
const EXPECTED_TRANSACTION = {
11+
transaction: 'Test Transaction',
12+
spans: expect.arrayContaining([
13+
expect.objectContaining({
14+
data: expect.objectContaining({
15+
'db.system': 'postgresql',
16+
'db.name': 'tests',
17+
'sentry.origin': 'manual',
18+
'sentry.op': 'db',
19+
}),
20+
description: 'pg.connect',
21+
op: 'db',
22+
status: 'ok',
23+
}),
24+
expect.objectContaining({
25+
data: expect.objectContaining({
26+
'db.system': 'postgresql',
27+
'db.name': 'tests',
28+
'db.statement': 'INSERT INTO "NativeUser" ("email", "name") VALUES ($1, $2)',
29+
'sentry.origin': 'auto.db.otel.postgres',
30+
'sentry.op': 'db',
31+
}),
32+
description: 'INSERT INTO "NativeUser" ("email", "name") VALUES ($1, $2)',
33+
op: 'db',
34+
status: 'ok',
35+
origin: 'auto.db.otel.postgres',
36+
}),
37+
expect.objectContaining({
38+
data: expect.objectContaining({
39+
'db.system': 'postgresql',
40+
'db.name': 'tests',
41+
'db.statement': 'SELECT * FROM "NativeUser"',
42+
'sentry.origin': 'auto.db.otel.postgres',
43+
'sentry.op': 'db',
44+
}),
45+
description: 'SELECT * FROM "NativeUser"',
46+
op: 'db',
47+
status: 'ok',
48+
origin: 'auto.db.otel.postgres',
49+
}),
50+
]),
51+
};
52+
53+
await createRunner(__dirname, 'scenario.js')
54+
.withDockerCompose({
55+
workingDirectory: [__dirname],
56+
setupCommand: 'yarn',
57+
})
58+
.expect({ transaction: EXPECTED_TRANSACTION })
59+
.start()
60+
.completed();
61+
});
62+
});
63+
});

dev-packages/node-integration-tests/suites/tracing/postgres/test.ts

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ describe('postgres auto instrumentation', () => {
4949
await createRunner(__dirname, 'scenario.js')
5050
.withDockerCompose({
5151
workingDirectory: [__dirname],
52-
setupCommand: 'yarn',
5352
})
5453
.expect({ transaction: EXPECTED_TRANSACTION })
5554
.start()
@@ -60,7 +59,6 @@ describe('postgres auto instrumentation', () => {
6059
await createRunner(__dirname, 'scenario-ignoreConnect.js')
6160
.withDockerCompose({
6261
workingDirectory: [__dirname],
63-
setupCommand: 'yarn',
6462
})
6563
.expect({
6664
transaction: txn => {
@@ -102,58 +100,4 @@ describe('postgres auto instrumentation', () => {
102100
.start()
103101
.completed();
104102
});
105-
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',
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',
128-
}),
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',
141-
}),
142-
description: 'SELECT * FROM "NativeUser"',
143-
op: 'db',
144-
status: 'ok',
145-
origin: 'auto.db.otel.postgres',
146-
}),
147-
]),
148-
};
149-
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-
});
159103
});

0 commit comments

Comments
 (0)