@@ -129,7 +129,7 @@ describe('@google-cloud/debug end-to-end behavior', function () {
129129 } ) ;
130130
131131 it ( 'should set breakpoints correctly' , function ( ) {
132- this . timeout ( 25 * 1000 ) ;
132+ this . timeout ( 90 * 1000 ) ;
133133 // Kick off promise chain by getting a list of debuggees
134134 return api . listDebuggees ( projectId ) . then ( function ( results ) {
135135 // Check that the debuggee created in this test is among the list of
@@ -188,7 +188,7 @@ describe('@google-cloud/debug end-to-end behavior', function () {
188188 console . log ( '-- waiting before checking if the log was written' ) ;
189189 return Promise . all ( [ breakpoint , delay ( 10 * 1000 ) ] ) ;
190190 } ) . then ( function ( results ) {
191- // Check the contents of the log, and then delete the breakpoint
191+ // Check the contents of the log, but keep the original breakpoint.
192192
193193 var breakpoint = results [ 0 ] ;
194194
@@ -197,13 +197,13 @@ describe('@google-cloud/debug end-to-end behavior', function () {
197197 'transcript in child ' + index + ' should contain value of o: ' +
198198 child . transcript ) ;
199199 } ) ;
200- return api . deleteBreakpoint ( debuggeeId , breakpoint . id ) ;
200+ return Promise . resolve ( ) ;
201201 } ) . then ( function ( ) {
202202 // Set another breakpoint at the same location
203203
204204 console . log ( '-- setting a breakpoint' ) ;
205205 return api . setBreakpoint ( debuggeeId , {
206- id : 'breakpoint-1 ' ,
206+ id : 'breakpoint-2 ' ,
207207 location : { path : FILENAME , line : 5 } ,
208208 expressions : [ 'process' ] , // Process for large variable
209209 condition : 'n === 10'
@@ -254,12 +254,24 @@ describe('@google-cloud/debug end-to-end behavior', function () {
254254 assert . strictEqual ( arg . value , '10' ) ;
255255 console . log ( '-- checking log point was hit again' ) ;
256256 children . forEach ( function ( child ) {
257- assert . ok ( child . transcript
258- . split ( 'LOGPOINT: o is: {"a":[1,"hi",true]}' ) . length > 4 ) ;
257+ const count = ( child . transcript
258+ . match ( / L O G P O I N T : o i s : \{ " a " : \[ 1 , " h i " , t r u e \] \} / g) || [ ] ) . length ;
259+ assert . ok ( count > 4 ) ;
259260 } ) ;
260261
261262 return api . deleteBreakpoint ( debuggeeId , breakpoint . id ) ;
262263 } ) . then ( function ( ) {
264+ // wait for 60 seconds
265+ console . log ( '-- waiting for 60 seconds' ) ;
266+ return delay ( 60 * 1000 ) ;
267+ } ) . then ( function ( ) {
268+ // Make sure the log point is continuing to be hit.
269+ console . log ( '-- checking log point was hit again' ) ;
270+ children . forEach ( function ( child ) {
271+ const count = ( child . transcript
272+ . match ( / L O G P O I N T : o i s : \{ " a " : \[ 1 , " h i " , t r u e \] \} / g) || [ ] ) . length ;
273+ assert . ok ( count > 60 ) ;
274+ } ) ;
263275 console . log ( '-- test passed' ) ;
264276 return Promise . resolve ( ) ;
265277 } ) ;
@@ -305,7 +317,7 @@ describe('@google-cloud/debug end-to-end behavior', function () {
305317
306318 console . log ( '-- setting a logpoint' ) ;
307319 return api . setBreakpoint ( debuggeeId , {
308- id : 'breakpoint-1 ' ,
320+ id : 'breakpoint-3 ' ,
309321 location : { path : FILENAME , line : 5 } ,
310322 condition : 'n === 10' ,
311323 action : 'LOG' ,
@@ -332,8 +344,8 @@ describe('@google-cloud/debug end-to-end behavior', function () {
332344 // If no throttling occurs, we expect ~20 logs since we are logging
333345 // 2x per second over a 10 second period.
334346 children . forEach ( function ( child ) {
335- var logCount = child . transcript
336- . split ( ' LOGPOINT: o is: {"a":[1,"hi",true]}' ) . length - 1 ;
347+ const logCount = ( child . transcript
348+ . match ( / L O G P O I N T : o i s : \ {" a " : \ [1 , " h i " , t r u e \] \} / g ) || [ ] ) . length ;
337349 // A log count of greater than 10 indicates that we did not successfully
338350 // pause when the rate of `maxLogsPerSecond` was reached.
339351 assert ( logCount <= 10 , 'log count is greater than 10: ' + logCount ) ;
0 commit comments