@@ -10,6 +10,7 @@ const expect = require('chai').expect;
1010const constants = require ( '@instana/core' ) . tracing . constants ;
1111const supportedVersion = require ( '@instana/core' ) . tracing . supportedVersion ;
1212const testConfig = require ( '../../core/test/config' ) ;
13+ const normalizeConfig = require ( '../src/util/normalizeConfig' ) ;
1314const testUtils = require ( '../../core/test/test_util' ) ;
1415
1516const dummyEntry = {
@@ -62,7 +63,6 @@ mochaSuiteFn('agent connection', function () {
6263 const { AgentStubControls } = require ( './apps/agentStubControls' ) ;
6364 const agentControls = new AgentStubControls ( ) ;
6465
65- const config = { logger : testUtils . createFakeLogger ( ) } ;
6666 const pidStore = require ( '../src/pidStore' ) ;
6767 let agentConnection ;
6868
@@ -74,6 +74,9 @@ mochaSuiteFn('agent connection', function () {
7474 } ) ;
7575
7676 beforeEach ( async ( ) => {
77+ const config = normalizeConfig ( { agentPort : agentControls . getPort ( ) } ) ;
78+ config . logger = testUtils . createFakeLogger ( ) ;
79+
7780 agentConnection = require ( '../src/agentConnection' ) ;
7881 pidStore . init ( config ) ;
7982 agentConnection . init ( config , pidStore ) ;
@@ -83,7 +86,11 @@ mochaSuiteFn('agent connection', function () {
8386 } ) ;
8487
8588 it ( 'should send traces to agent' , done => {
86- agentConnection . sendSpans ( dummySpans , ( ) => {
89+ agentConnection . sendSpans ( dummySpans , err => {
90+ if ( err ) {
91+ return done ( err ) ;
92+ }
93+
8794 agentControls
8895 . getSpans ( )
8996 . then ( spans => {
@@ -98,7 +105,10 @@ mochaSuiteFn('agent connection', function () {
98105 const circularSpanWithoutCircularReference = Object . assign ( { } , circularSpan ) ;
99106 delete circularSpanWithoutCircularReference . data . c . circular ;
100107
101- agentConnection . sendSpans ( dummySpansWithCircularReference , ( ) => {
108+ agentConnection . sendSpans ( dummySpansWithCircularReference , err => {
109+ if ( err ) {
110+ return done ( err ) ;
111+ }
102112 agentControls
103113 . getSpans ( )
104114 . then ( spans => {
0 commit comments