Skip to content

Commit 3bde47b

Browse files
author
Jordi Bertran de Balanda
committed
add v1 tests to cache integrations
1 parent 3ecb969 commit 3bde47b

File tree

4 files changed

+46
-0
lines changed

4 files changed

+46
-0
lines changed

packages/datadog-plugin-ioredis/test/index.spec.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const agent = require('../../dd-trace/test/plugins/agent')
44
const { breakThen, unbreakThen } = require('../../dd-trace/test/plugins/helpers')
55
const { ERROR_MESSAGE, ERROR_TYPE, ERROR_STACK } = require('../../dd-trace/src/constants')
66

7+
const Nomenclature = require('../../dd-trace/src/service-naming')
78
const namingSchema = require('./naming')
89

910
describe('Plugin', () => {
@@ -105,6 +106,12 @@ describe('Plugin', () => {
105106

106107
redis.get('foo').catch(done)
107108
})
109+
110+
withNamingSchema(
111+
done => redis.get('foo').catch(done),
112+
() => namingSchema.outbound.opName,
113+
() => namingSchema.outbound.serviceName
114+
)
108115
})
109116

110117
describe('with configuration', () => {
@@ -137,6 +144,15 @@ describe('Plugin', () => {
137144

138145
redis.get('foo').catch(done)
139146
})
147+
148+
withNamingSchema(
149+
done => redis.get('foo').catch(done),
150+
() => namingSchema.outbound.opName,
151+
() => {
152+
if (Nomenclature.version === 'v0') return 'custom-test'
153+
return 'custom'
154+
}
155+
)
140156
})
141157

142158
describe('with legacy configuration', () => {

packages/datadog-plugin-memcached/test/index.spec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ describe('Plugin', () => {
143143
done()
144144
}
145145
})
146+
147+
withNamingSchema(
148+
done => memcached.get('test', err => err && done(err)),
149+
() => namingSchema.outbound.opName,
150+
() => namingSchema.outbound.serviceName
151+
)
146152
})
147153

148154
describe('with configuration', () => {

packages/datadog-plugin-redis/test/client.spec.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ describe('Plugin', () => {
9494
await client.get('foo')
9595
await promise
9696
})
97+
98+
withNamingSchema(
99+
async () => client.get('foo'),
100+
() => namingSchema.outbound.opName,
101+
() => namingSchema.outbound.serviceName
102+
)
97103
})
98104

99105
describe('with configuration', () => {
@@ -136,6 +142,12 @@ describe('Plugin', () => {
136142
await client.get('foo')
137143
await promise
138144
})
145+
146+
withNamingSchema(
147+
async () => client.get('foo'),
148+
() => namingSchema.outbound.opName,
149+
() => 'custom'
150+
)
139151
})
140152

141153
describe('with blocklist', () => {

packages/datadog-plugin-redis/test/legacy.spec.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ describe('Legacy Plugin', () => {
137137
assertError()
138138
})
139139
})
140+
141+
withNamingSchema(
142+
() => client.get('foo', () => {}),
143+
() => namingSchema.outbound.opName,
144+
() => namingSchema.outbound.serviceName
145+
)
140146
})
141147

142148
describe('with configuration', () => {
@@ -179,6 +185,12 @@ describe('Legacy Plugin', () => {
179185

180186
client.get('foo', () => {})
181187
})
188+
189+
withNamingSchema(
190+
() => client.get('foo', () => {}),
191+
() => namingSchema.outbound.opName,
192+
() => 'custom'
193+
)
182194
})
183195

184196
describe('with legacy configuration', () => {

0 commit comments

Comments
 (0)