-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathtest.ts
More file actions
52 lines (49 loc) · 1.67 KB
/
test.ts
File metadata and controls
52 lines (49 loc) · 1.67 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
43
44
45
46
47
48
49
50
51
52
import { afterAll, describe, expect, test } from 'vitest';
import { cleanupChildProcesses, createRunner } from '../../../utils/runner';
describe('redis auto instrumentation', () => {
afterAll(() => {
cleanupChildProcesses();
});
test(
'should auto-instrument `ioredis` package when using redis.set() and redis.get()',
{ timeout: 75_000 },
async () => {
const EXPECTED_TRANSACTION = {
transaction: 'Test Span',
spans: expect.arrayContaining([
expect.objectContaining({
description: 'set test-key [1 other arguments]',
op: 'db',
origin: 'auto.db.otel.redis',
data: expect.objectContaining({
'sentry.op': 'db',
'sentry.origin': 'auto.db.otel.redis',
'db.system': 'redis',
'net.peer.name': 'localhost',
'net.peer.port': 6379,
'db.statement': 'set test-key [1 other arguments]',
}),
}),
expect.objectContaining({
description: 'get test-key',
op: 'db',
origin: 'auto.db.otel.redis',
data: expect.objectContaining({
'sentry.op': 'db',
'sentry.origin': 'auto.db.otel.redis',
'db.system': 'redis',
'net.peer.name': 'localhost',
'net.peer.port': 6379,
'db.statement': 'get test-key',
}),
}),
]),
};
await createRunner(__dirname, 'scenario-ioredis.js')
.withDockerCompose({ workingDirectory: [__dirname] })
.expect({ transaction: EXPECTED_TRANSACTION })
.start()
.completed();
},
);
});