Skip to content

Commit 2e466d8

Browse files
nicohrubeccodex
andcommitted
test(node): preserve Postgres span ordering assertions
Co-Authored-By: GPT-6 <codex@openai.com>
1 parent 16d71d9 commit 2e466d8

1 file changed

Lines changed: 27 additions & 3 deletions

File tree

  • dev-packages/node-integration-tests/suites/tracing/postgres

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

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,16 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [
167167
.expect({
168168
span: container => {
169169
expect(container).toMatchObject(EXPECTED_SPANS);
170-
expect(container.items.filter(span => span.attributes[SENTRY_OP]?.value === DB)).toHaveLength(7);
170+
const dbSpans = container.items.filter(span => span.attributes[SENTRY_OP]?.value === DB);
171+
expect(dbSpans.map(span => span.name)).toEqual([
172+
'pg.connect',
173+
'CREATE TABLE "User"',
174+
'INSERT "User"',
175+
'SELECT "User"',
176+
'SELECT "User"',
177+
'SELECT "does_not_exist_table"',
178+
'DROP TABLE "User"',
179+
]);
171180
},
172181
})
173182
.start()
@@ -182,7 +191,15 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [
182191
await createTestRunner()
183192
.expect({
184193
span: container => {
185-
expect(container.items.filter(span => span.attributes[SENTRY_OP]?.value === DB)).toHaveLength(6);
194+
const dbSpans = container.items.filter(span => span.attributes[SENTRY_OP]?.value === DB);
195+
expect(dbSpans.map(span => span.name)).toEqual([
196+
'CREATE TABLE "User"',
197+
'INSERT "User"',
198+
'SELECT "User"',
199+
'SELECT "User"',
200+
'SELECT "does_not_exist_table"',
201+
'DROP TABLE "User"',
202+
]);
186203
const spanNames = container.items.map(span => span.name);
187204
expect(spanNames?.find(name => name?.includes('connect'))).toBeUndefined();
188205
expect(container).toMatchObject({
@@ -504,7 +521,14 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [
504521
.expect({
505522
span: container => {
506523
expect(container).toMatchObject(EXPECTED_SPANS);
507-
expect(container.items.filter(span => span.attributes[SENTRY_OP]?.value === DB)).toHaveLength(5);
524+
const dbSpans = container.items.filter(span => span.attributes[SENTRY_OP]?.value === DB);
525+
expect(dbSpans.map(span => span.name)).toEqual([
526+
'pg.connect',
527+
'CREATE TABLE "NativeUser"',
528+
'INSERT "NativeUser"',
529+
'SELECT "NativeUser"',
530+
'DROP TABLE "NativeUser"',
531+
]);
508532
},
509533
})
510534
.start()

0 commit comments

Comments
 (0)