Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions packages/datadog-plugin-fetch/test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ const tags = require('../../../ext/tags')
const { expect } = require('chai')
const { storage } = require('../../datadog-core')
const { ERROR_MESSAGE, ERROR_TYPE, ERROR_STACK } = require('../../dd-trace/src/constants')
const { DD_MAJOR } = require('../../../version')

const HTTP_REQUEST_HEADERS = tags.HTTP_REQUEST_HEADERS
const HTTP_RESPONSE_HEADERS = tags.HTTP_RESPONSE_HEADERS

const SERVICE_NAME = DD_MAJOR < 3 ? 'test-http-client' : 'test'
const describe = globalThis.fetch ? globalThis.describe : globalThis.describe.skip

describe('Plugin', () => {
Expand Down Expand Up @@ -52,7 +54,7 @@ describe('Plugin', () => {
getPort().then(port => {
agent
.use(traces => {
expect(traces[0][0]).to.have.property('service', 'test')
expect(traces[0][0]).to.have.property('service', SERVICE_NAME)
expect(traces[0][0]).to.have.property('type', 'http')
expect(traces[0][0]).to.have.property('resource', 'GET')
expect(traces[0][0].meta).to.have.property('span.kind', 'client')
Expand All @@ -79,7 +81,7 @@ describe('Plugin', () => {
getPort().then(port => {
agent
.use(traces => {
expect(traces[0][0]).to.have.property('service', 'test')
expect(traces[0][0]).to.have.property('service', SERVICE_NAME)
expect(traces[0][0]).to.have.property('type', 'http')
expect(traces[0][0]).to.have.property('resource', 'GET')
expect(traces[0][0].meta).to.have.property('span.kind', 'client')
Expand All @@ -106,7 +108,7 @@ describe('Plugin', () => {
getPort().then(port => {
agent
.use(traces => {
expect(traces[0][0]).to.have.property('service', 'test')
expect(traces[0][0]).to.have.property('service', SERVICE_NAME)
expect(traces[0][0]).to.have.property('type', 'http')
expect(traces[0][0]).to.have.property('resource', 'GET')
expect(traces[0][0].meta).to.have.property('span.kind', 'client')
Expand Down Expand Up @@ -390,7 +392,7 @@ describe('Plugin', () => {
getPort().then(port => {
agent
.use(traces => {
expect(traces[0][0]).to.have.property('service', 'test')
expect(traces[0][0]).to.have.property('service', SERVICE_NAME)
})
.then(done)
.catch(done)
Expand Down
10 changes: 6 additions & 4 deletions packages/datadog-plugin-http/test/client.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ const { storage } = require('../../datadog-core')
const key = fs.readFileSync(path.join(__dirname, './ssl/test.key'))
const cert = fs.readFileSync(path.join(__dirname, './ssl/test.crt'))
const { ERROR_MESSAGE, ERROR_TYPE, ERROR_STACK } = require('../../dd-trace/src/constants')
const { DD_MAJOR } = require('../../../version')

const HTTP_REQUEST_HEADERS = tags.HTTP_REQUEST_HEADERS
const HTTP_RESPONSE_HEADERS = tags.HTTP_RESPONSE_HEADERS
const NODE_MAJOR = parseInt(process.versions.node.split('.')[0])
const SERVICE_NAME = DD_MAJOR < 3 ? 'test-http-client' : 'test'

describe('Plugin', () => {
let express
Expand Down Expand Up @@ -64,7 +66,7 @@ describe('Plugin', () => {
getPort().then(port => {
agent
.use(traces => {
expect(traces[0][0]).to.have.property('service', 'test')
expect(traces[0][0]).to.have.property('service', SERVICE_NAME)
expect(traces[0][0]).to.have.property('type', 'http')
expect(traces[0][0]).to.have.property('resource', 'GET')
expect(traces[0][0].meta).to.have.property('span.kind', 'client')
Expand Down Expand Up @@ -121,7 +123,7 @@ describe('Plugin', () => {
getPort().then(port => {
agent
.use(traces => {
expect(traces[0][0]).to.have.property('service', 'test')
expect(traces[0][0]).to.have.property('service', SERVICE_NAME)
expect(traces[0][0]).to.have.property('type', 'http')
expect(traces[0][0]).to.have.property('resource', 'CONNECT')
expect(traces[0][0].meta).to.have.property('span.kind', 'client')
Expand Down Expand Up @@ -166,7 +168,7 @@ describe('Plugin', () => {
getPort().then(port => {
agent
.use(traces => {
expect(traces[0][0]).to.have.property('service', 'test')
expect(traces[0][0]).to.have.property('service', SERVICE_NAME)
expect(traces[0][0]).to.have.property('type', 'http')
expect(traces[0][0]).to.have.property('resource', 'GET')
expect(traces[0][0].meta).to.have.property('span.kind', 'client')
Expand Down Expand Up @@ -825,7 +827,7 @@ describe('Plugin', () => {
getPort().then(port => {
agent
.use(traces => {
expect(traces[0][0]).to.have.property('service', 'test')
expect(traces[0][0]).to.have.property('service', SERVICE_NAME)
})
.then(done)
.catch(done)
Expand Down
4 changes: 3 additions & 1 deletion packages/datadog-plugin-http2/test/client.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ const tags = require('../../../ext/tags')
const key = fs.readFileSync(path.join(__dirname, './ssl/test.key'))
const cert = fs.readFileSync(path.join(__dirname, './ssl/test.crt'))
const { ERROR_MESSAGE, ERROR_TYPE, ERROR_STACK } = require('../../dd-trace/src/constants')
const { DD_MAJOR } = require('../../../version')

const HTTP_REQUEST_HEADERS = tags.HTTP_REQUEST_HEADERS
const HTTP_RESPONSE_HEADERS = tags.HTTP_RESPONSE_HEADERS
const SERVICE_NAME = DD_MAJOR < 3 ? 'test-http-client' : 'test'

describe('Plugin', () => {
let http2
Expand Down Expand Up @@ -63,7 +65,7 @@ describe('Plugin', () => {
getPort().then(port => {
agent
.use(traces => {
expect(traces[0][0]).to.have.property('service', 'test')
expect(traces[0][0]).to.have.property('service', SERVICE_NAME)
expect(traces[0][0]).to.have.property('type', 'http')
expect(traces[0][0]).to.have.property('resource', 'GET')
expect(traces[0][0].meta).to.have.property('span.kind', 'client')
Expand Down