Skip to content

Commit

Permalink
add v1 tests to cache integrations
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordi Bertran de Balanda committed Apr 27, 2023
1 parent 825ffe7 commit aeeefde
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/datadog-plugin-ioredis/test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const agent = require('../../dd-trace/test/plugins/agent')
const { breakThen, unbreakThen } = require('../../dd-trace/test/plugins/helpers')
const { ERROR_MESSAGE, ERROR_TYPE, ERROR_STACK } = require('../../dd-trace/src/constants')

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

describe('Plugin', () => {
Expand Down Expand Up @@ -105,6 +106,12 @@ describe('Plugin', () => {

redis.get('foo').catch(done)
})

withNamingSchema(
done => redis.get('foo').catch(done),
() => namingSchema.outbound.opName,
() => namingSchema.outbound.serviceName
)
})

describe('with configuration', () => {
Expand Down Expand Up @@ -137,6 +144,15 @@ describe('Plugin', () => {

redis.get('foo').catch(done)
})

withNamingSchema(
done => redis.get('foo').catch(done),
() => namingSchema.outbound.opName,
() => {
if (Nomenclature.version === 'v0') return 'custom-test'
return 'custom'
}
)
})

describe('with legacy configuration', () => {
Expand Down
6 changes: 6 additions & 0 deletions packages/datadog-plugin-memcached/test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ describe('Plugin', () => {
done()
}
})

withNamingSchema(
done => memcached.get('test', err => err && done(err)),
() => namingSchema.outbound.opName,
() => namingSchema.outbound.serviceName
)
})

describe('with configuration', () => {
Expand Down
12 changes: 12 additions & 0 deletions packages/datadog-plugin-redis/test/client.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ describe('Plugin', () => {
await client.get('foo')
await promise
})

withNamingSchema(
async () => client.get('foo'),
() => namingSchema.outbound.opName,
() => namingSchema.outbound.serviceName
)
})

describe('with configuration', () => {
Expand Down Expand Up @@ -136,6 +142,12 @@ describe('Plugin', () => {
await client.get('foo')
await promise
})

withNamingSchema(
async () => client.get('foo'),
() => namingSchema.outbound.opName,
() => 'custom'
)
})

describe('with blocklist', () => {
Expand Down
12 changes: 12 additions & 0 deletions packages/datadog-plugin-redis/test/legacy.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ describe('Legacy Plugin', () => {
assertError()
})
})

withNamingSchema(
() => client.get('foo', () => {}),
() => namingSchema.outbound.opName,
() => namingSchema.outbound.serviceName
)
})

describe('with configuration', () => {
Expand Down Expand Up @@ -179,6 +185,12 @@ describe('Legacy Plugin', () => {

client.get('foo', () => {})
})

withNamingSchema(
() => client.get('foo', () => {}),
() => namingSchema.outbound.opName,
() => 'custom'
)
})

describe('with legacy configuration', () => {
Expand Down

0 comments on commit aeeefde

Please sign in to comment.