@@ -80,8 +80,9 @@ describe('Log', () => {
8080 } ) ;
8181
8282 // Create a mock Logging instance
83- function createLogger ( maxEntrySize ?: number ) {
83+ function createLogger ( maxEntrySize ?: number , maxRetries ?: number ) {
8484 LOGGING = {
85+ options : maxRetries !== undefined ? { maxRetries : maxRetries } : undefined ,
8586 projectId : '{{project-id}}' ,
8687 entry : sinon . stub ( ) ,
8788 setProjectId : sinon . stub ( ) ,
@@ -114,7 +115,6 @@ describe('Log', () => {
114115 if ( maxEntrySize ) {
115116 options . maxEntrySize = maxEntrySize ;
116117 }
117-
118118 return new Log ( LOGGING , LOG_NAME , options ) ;
119119 }
120120
@@ -578,6 +578,32 @@ describe('Log', () => {
578578 )
579579 ) ;
580580 } ) ;
581+
582+ it ( 'should pass through global options' , async ( ) => {
583+ log = createLogger ( undefined , 1 ) ;
584+ decorateEntriesStub = sinon . stub ( log , 'decorateEntries' ) . returnsArg ( 0 ) ;
585+ await log . write ( ENTRIES , OPTIONS ) ;
586+ assert (
587+ log . logging . loggingService . writeLogEntries . calledWith (
588+ sinon . match . any ,
589+ {
590+ maxRetries : 1 ,
591+ } ,
592+ sinon . match . any
593+ )
594+ ) ;
595+ log . logging . loggingService . writeLogEntries . reset ( ) ;
596+ await log . write ( ENTRIES , { gaxOptions : { maxRetries : 10 } } ) ;
597+ assert (
598+ log . logging . loggingService . writeLogEntries . calledWith (
599+ sinon . match . any ,
600+ {
601+ maxRetries : 10 ,
602+ } ,
603+ sinon . match . any
604+ )
605+ ) ;
606+ } ) ;
581607 } ) ;
582608
583609 describe ( 'decorateEntries' , ( ) => {
0 commit comments