-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathtest.ts
More file actions
42 lines (39 loc) · 1.28 KB
/
test.ts
File metadata and controls
42 lines (39 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { afterAll, describe, expect, test } from 'vitest';
import { cleanupChildProcesses, createRunner } from '../../../utils/runner';
describe('mysql2 auto instrumentation', () => {
afterAll(() => {
cleanupChildProcesses();
});
test('should auto-instrument `mysql` package without connection.connect()', { timeout: 75_000 }, async () => {
const EXPECTED_TRANSACTION = {
transaction: 'Test Transaction',
spans: expect.arrayContaining([
expect.objectContaining({
description: 'SELECT 1 + 1 AS solution',
op: 'db',
data: expect.objectContaining({
'db.system': 'mysql',
'net.peer.name': 'localhost',
'net.peer.port': 3306,
'db.user': 'root',
}),
}),
expect.objectContaining({
description: 'SELECT NOW()',
op: 'db',
data: expect.objectContaining({
'db.system': 'mysql',
'net.peer.name': 'localhost',
'net.peer.port': 3306,
'db.user': 'root',
}),
}),
]),
};
await createRunner(__dirname, 'scenario.js')
.withDockerCompose({ workingDirectory: [__dirname] })
.expect({ transaction: EXPECTED_TRANSACTION })
.start()
.completed();
});
});