Skip to content

Commit ba068e2

Browse files
committed
Unroll the two-query loop in the db spec
1 parent 8c3c6e9 commit ba068e2

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

  • dev-packages/e2e-tests/test-applications/astro-7/tests

dev-packages/e2e-tests/test-applications/astro-7/tests/db.test.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,21 @@ test('Instruments mysql automatically', async ({ baseURL }) => {
4747

4848
// With span streaming the span name is the low-cardinality query summary; the statement stays in
4949
// `db.query.text`.
50-
for (const query of ['SELECT 1 + 1 AS solution', 'SELECT NOW()']) {
51-
expect(mysqlSpans).toContainEqual(
52-
expect.objectContaining({
53-
name: 'SELECT',
54-
status: 'ok',
55-
attributes: expect.objectContaining({
56-
'sentry.origin': { value: 'auto.db.mysql', type: 'string' },
57-
'db.system.name': { value: 'mysql', type: 'string' },
58-
'db.query.text': { value: query, type: 'string' },
59-
'db.user': { value: 'root', type: 'string' },
60-
'db.connection_string': { value: expect.any(String), type: 'string' },
61-
'server.address': { value: expect.any(String), type: 'string' },
62-
'server.port': { value: 3306, type: 'integer' },
63-
}),
50+
const expectedQuerySpan = (query: string) =>
51+
expect.objectContaining({
52+
name: 'SELECT',
53+
status: 'ok',
54+
attributes: expect.objectContaining({
55+
'sentry.origin': { value: 'auto.db.mysql', type: 'string' },
56+
'db.system.name': { value: 'mysql', type: 'string' },
57+
'db.query.text': { value: query, type: 'string' },
58+
'db.user': { value: 'root', type: 'string' },
59+
'db.connection_string': { value: expect.any(String), type: 'string' },
60+
'server.address': { value: expect.any(String), type: 'string' },
61+
'server.port': { value: 3306, type: 'integer' },
6462
}),
65-
);
66-
}
63+
});
64+
65+
expect(mysqlSpans).toContainEqual(expectedQuerySpan('SELECT 1 + 1 AS solution'));
66+
expect(mysqlSpans).toContainEqual(expectedQuerySpan('SELECT NOW()'));
6767
});

0 commit comments

Comments
 (0)