@@ -566,7 +566,7 @@ describe('tracing/spanBuffer', () => {
566
566
verifyNoBatching ( span1 , span2 ) ;
567
567
} ) ;
568
568
} ) ;
569
- describe ( 'processSpan fn ' , ( ) => {
569
+ describe ( 'when ignoreEndpoints is enabled ' , ( ) => {
570
570
before ( ( ) => {
571
571
spanBuffer . init (
572
572
{
@@ -597,15 +597,26 @@ describe('tracing/spanBuffer', () => {
597
597
}
598
598
} ;
599
599
600
- it ( 'should filter out the span when command is listed in ignoreEndpoints config' , ( ) => {
601
- expect ( spanBuffer . processSpan ( span ) ) . to . equal ( null ) ;
600
+ it ( 'should ignore the redis span when the operation is listed in the ignoreEndpoints config' , ( ) => {
601
+ spanBuffer . addSpan ( span ) ;
602
+ const spans = spanBuffer . getAndResetSpans ( ) ;
603
+ expect ( spans ) . to . have . lengthOf ( 0 ) ;
602
604
} ) ;
603
605
604
- it ( 'should transform and return the span for command not specified in ignoreEndpoints config' , ( ) => {
606
+ it ( 'should transform the redis span if the operation is not specified in the ignoreEndpoints config' , ( ) => {
605
607
span . data . redis . operation = 'set' ;
606
- const result = spanBuffer . processSpan ( span ) ;
607
- expect ( result . data . redis . command ) . to . equal ( 'set' ) ;
608
- expect ( result . data . redis ) . to . not . have . property ( 'operation' ) ;
608
+ spanBuffer . addSpan ( span ) ;
609
+ const spans = spanBuffer . getAndResetSpans ( ) ;
610
+ expect ( spans ) . to . have . lengthOf ( 1 ) ;
611
+ expect ( span . data . redis . command ) . to . equal ( 'set' ) ;
612
+ expect ( span . data . redis ) . to . not . have . property ( 'operation' ) ;
613
+ } ) ;
614
+ it ( 'should return the span unmodified for unsupported ignore endpoints' , ( ) => {
615
+ span . n = 'http' ;
616
+ spanBuffer . addSpan ( span ) ;
617
+ const spans = spanBuffer . getAndResetSpans ( ) ;
618
+ expect ( spans ) . to . have . lengthOf ( 1 ) ;
619
+ expect ( span ) . to . deep . equal ( span ) ;
609
620
} ) ;
610
621
} ) ;
611
622
} ) ;
0 commit comments