@@ -25,26 +25,25 @@ describe('Plugin', () => {
2525 } )
2626
2727 describe ( 'without configuration' , ( ) => {
28- before ( ( ) => agent . load ( [ 'ioredis' ] ) )
28+ beforeEach ( ( ) => agent . load ( [ 'ioredis' ] ) )
2929
30- after ( ( ) => agent . close ( { ritmReset : false } ) )
30+ afterEach ( ( ) => agent . close ( { ritmReset : false } ) )
3131
3232 it ( 'should do automatic instrumentation when using callbacks' , done => {
3333 agent . use ( ( ) => { } ) // wait for initial info command
34- agent
35- . use ( traces => {
36- expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'name' , expectedSchema . outbound . opName )
37- expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'service' , expectedSchema . outbound . serviceName )
38- expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'resource' , 'get' )
39- expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'type' , 'redis' )
40- expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'component' , 'ioredis' )
41- expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'db.name' , '0' )
42- expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'db.type' , 'redis' )
43- expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'span.kind' , 'client' )
44- expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'out.host' , 'localhost' )
45- expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'redis.raw_command' , 'GET foo' )
46- expect ( traces [ 0 ] [ 0 ] . metrics ) . to . have . property ( 'network.destination.port' , 6379 )
47- } )
34+ agent . use ( traces => {
35+ expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'name' , expectedSchema . outbound . opName )
36+ expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'service' , expectedSchema . outbound . serviceName )
37+ expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'resource' , 'get' )
38+ expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'type' , 'redis' )
39+ expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'component' , 'ioredis' )
40+ expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'db.name' , '0' )
41+ expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'db.type' , 'redis' )
42+ expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'span.kind' , 'client' )
43+ expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'out.host' , 'localhost' )
44+ expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'redis.raw_command' , 'GET foo' )
45+ expect ( traces [ 0 ] [ 0 ] . metrics ) . to . have . property ( 'network.destination.port' , 6379 )
46+ } )
4847 . then ( done )
4948 . catch ( done )
5049
@@ -54,11 +53,9 @@ describe('Plugin', () => {
5453 it ( 'should run the callback in the parent context' , ( ) => {
5554 const span = { }
5655
57- return tracer . scope ( ) . activate ( span , ( ) => {
58- return redis . get ( 'foo' )
59- . then ( ( ) => {
60- expect ( tracer . scope ( ) . active ( ) ) . to . equal ( span )
61- } )
56+ return tracer . scope ( ) . activate ( span , async ( ) => {
57+ await redis . get ( 'foo' )
58+ expect ( tracer . scope ( ) . active ( ) ) . to . equal ( span )
6259 } )
6360 } )
6461
0 commit comments