|
3 | 3 | require('./setup/tap') |
4 | 4 |
|
5 | 5 | const Span = require('../src/opentracing/span') |
6 | | -const { storage } = require('../../datadog-core') |
7 | 6 | const Config = require('../src/config') |
8 | 7 | const tags = require('../../../ext/tags') |
9 | 8 | const { expect } = require('chai') |
10 | 9 | const { ERROR_MESSAGE, ERROR_TYPE, ERROR_STACK } = require('../../dd-trace/src/constants') |
11 | | -const { DD_MAJOR } = require('../../../version') |
12 | 10 |
|
13 | 11 | const SPAN_TYPE = tags.SPAN_TYPE |
14 | 12 | const RESOURCE_NAME = tags.RESOURCE_NAME |
15 | 13 | const SERVICE_NAME = tags.SERVICE_NAME |
16 | 14 | const EXPORT_SERVICE_NAME = 'service' |
17 | 15 | const BASE_SERVICE = tags.BASE_SERVICE |
18 | 16 |
|
19 | | -const describeOrphanable = DD_MAJOR < 4 ? describe : describe.skip |
20 | | - |
21 | 17 | describe('Tracer', () => { |
22 | 18 | let Tracer |
23 | 19 | let tracer |
@@ -283,64 +279,6 @@ describe('Tracer', () => { |
283 | 279 | }) |
284 | 280 | }) |
285 | 281 | }) |
286 | | - |
287 | | - describeOrphanable('when there is no parent span', () => { |
288 | | - it('should not trace if `orphanable: false`', () => { |
289 | | - sinon.spy(tracer, 'startSpan') |
290 | | - |
291 | | - tracer.trace('name', { orphanable: false }, () => {}) |
292 | | - |
293 | | - expect(tracer.startSpan).to.have.not.been.called |
294 | | - }) |
295 | | - |
296 | | - it('should trace if `orphanable: true`', () => { |
297 | | - sinon.spy(tracer, 'startSpan') |
298 | | - |
299 | | - tracer.trace('name', { orhpanable: true }, () => {}) |
300 | | - |
301 | | - expect(tracer.startSpan).to.have.been.called |
302 | | - }) |
303 | | - |
304 | | - it('should trace if `orphanable: undefined`', () => { |
305 | | - sinon.spy(tracer, 'startSpan') |
306 | | - |
307 | | - tracer.trace('name', {}, () => {}) |
308 | | - |
309 | | - expect(tracer.startSpan).to.have.been.called |
310 | | - }) |
311 | | - }) |
312 | | - |
313 | | - describeOrphanable('when there is a parent span', () => { |
314 | | - it('should trace if `orphanable: false`', () => { |
315 | | - tracer.scope().activate(tracer.startSpan('parent'), () => { |
316 | | - sinon.spy(tracer, 'startSpan') |
317 | | - |
318 | | - tracer.trace('name', { orhpanable: false }, () => {}) |
319 | | - |
320 | | - expect(tracer.startSpan).to.have.been.called |
321 | | - }) |
322 | | - }) |
323 | | - |
324 | | - it('should trace if `orphanable: true`', () => { |
325 | | - tracer.scope().activate(tracer.startSpan('parent'), () => { |
326 | | - sinon.spy(tracer, 'startSpan') |
327 | | - |
328 | | - tracer.trace('name', { orphanable: true }, () => {}) |
329 | | - |
330 | | - expect(tracer.startSpan).to.have.been.called |
331 | | - }) |
332 | | - }) |
333 | | - |
334 | | - it('should trace if `orphanable: undefined`', () => { |
335 | | - tracer.scope().activate(tracer.startSpan('parent'), () => { |
336 | | - sinon.spy(tracer, 'startSpan') |
337 | | - |
338 | | - tracer.trace('name', {}, () => {}) |
339 | | - |
340 | | - expect(tracer.startSpan).to.have.been.called |
341 | | - }) |
342 | | - }) |
343 | | - }) |
344 | 282 | }) |
345 | 283 |
|
346 | 284 | describe('getRumData', () => { |
@@ -470,87 +408,5 @@ describe('Tracer', () => { |
470 | 408 | tags: { sometag: 'somevalue', invocations: 2 } |
471 | 409 | }) |
472 | 410 | }) |
473 | | - |
474 | | - it('should not trace in a noop context', () => { |
475 | | - const fn = tracer.wrap('name', {}, () => {}) |
476 | | - |
477 | | - sinon.spy(tracer, 'trace') |
478 | | - |
479 | | - storage.enterWith({ noop: true }) |
480 | | - fn() |
481 | | - storage.enterWith(null) |
482 | | - |
483 | | - expect(tracer.trace).to.have.not.been.called |
484 | | - }) |
485 | | - |
486 | | - describeOrphanable('when there is no parent span', () => { |
487 | | - it('should not trace if `orphanable: false`', () => { |
488 | | - const fn = tracer.wrap('name', { orphanable: false }, () => {}) |
489 | | - |
490 | | - sinon.spy(tracer, 'trace') |
491 | | - |
492 | | - fn() |
493 | | - |
494 | | - expect(tracer.trace).to.have.not.been.called |
495 | | - }) |
496 | | - |
497 | | - it('should trace if `orphanable: true`', () => { |
498 | | - const fn = tracer.wrap('name', { orhpanable: true }, () => {}) |
499 | | - |
500 | | - sinon.spy(tracer, 'trace') |
501 | | - |
502 | | - fn() |
503 | | - |
504 | | - expect(tracer.trace).to.have.been.called |
505 | | - }) |
506 | | - |
507 | | - it('should trace if `orphanable: undefined`', () => { |
508 | | - const fn = tracer.wrap('name', {}, () => {}) |
509 | | - |
510 | | - sinon.spy(tracer, 'trace') |
511 | | - |
512 | | - fn() |
513 | | - |
514 | | - expect(tracer.trace).to.have.been.called |
515 | | - }) |
516 | | - }) |
517 | | - |
518 | | - describeOrphanable('when there is a parent span', () => { |
519 | | - it('should trace if `orphanable: false`', () => { |
520 | | - tracer.scope().activate(tracer.startSpan('parent'), () => { |
521 | | - const fn = tracer.wrap('name', { orhpanable: false }, () => {}) |
522 | | - |
523 | | - sinon.spy(tracer, 'trace') |
524 | | - |
525 | | - fn() |
526 | | - |
527 | | - expect(tracer.trace).to.have.been.called |
528 | | - }) |
529 | | - }) |
530 | | - |
531 | | - it('should trace if `orphanable: true`', () => { |
532 | | - tracer.scope().activate(tracer.startSpan('parent'), () => { |
533 | | - const fn = tracer.wrap('name', { orphanable: true }, () => {}) |
534 | | - |
535 | | - sinon.spy(tracer, 'trace') |
536 | | - |
537 | | - fn() |
538 | | - |
539 | | - expect(tracer.trace).to.have.been.called |
540 | | - }) |
541 | | - }) |
542 | | - |
543 | | - it('should trace if `orphanable: undefined`', () => { |
544 | | - tracer.scope().activate(tracer.startSpan('parent'), () => { |
545 | | - const fn = tracer.wrap('name', {}, () => {}) |
546 | | - |
547 | | - sinon.spy(tracer, 'trace') |
548 | | - |
549 | | - fn() |
550 | | - |
551 | | - expect(tracer.trace).to.have.been.called |
552 | | - }) |
553 | | - }) |
554 | | - }) |
555 | 411 | }) |
556 | 412 | }) |
0 commit comments