@@ -259,6 +259,7 @@ describe('Database', () => {
259259
260260 const SPANNER = {
261261 routeToLeaderEnabled : true ,
262+ options : { } ,
262263 } as { } as Spanner ;
263264
264265 const INSTANCE = {
@@ -405,6 +406,36 @@ describe('Database', () => {
405406 [ AFE_SERVER_TIMING_HEADER ] : 'true' ,
406407 } ) ;
407408 } ) ;
409+
410+ it ( 'should accept databaseRole in constructor' , ( ) => {
411+ const databaseRole = 'child_role' ;
412+ const database = new Database (
413+ INSTANCE ,
414+ NAME ,
415+ POOL_OPTIONS ,
416+ undefined ,
417+ databaseRole ,
418+ ) ;
419+ assert . strictEqual ( database . databaseRole , databaseRole ) ;
420+ } ) ;
421+
422+ it ( 'should use sessionLabels from Spanner options' , ( ) => {
423+ const sessionLabels = { env : 'test' } ;
424+ const spanner = new Spanner ( {
425+ sessionLabels,
426+ } ) ;
427+ const instanceCtx = {
428+ parent : spanner ,
429+ _observabilityOptions : { } ,
430+ request : util . noop ,
431+ requestStream : util . noop ,
432+ formattedName_ : 'instance-name' ,
433+ databases_ : new Map ( ) ,
434+ } as { } as Instance ;
435+
436+ const database = new Database ( instanceCtx , NAME ) ;
437+ assert . deepStrictEqual ( database . labels , sessionLabels ) ;
438+ } ) ;
408439 } ) ;
409440
410441 describe ( 'formatName_' , ( ) => {
@@ -468,7 +499,7 @@ describe('Database', () => {
468499
469500 const { reqOpts} = stub . lastCall . args [ 0 ] ;
470501
471- assert . strictEqual ( reqOpts . sessionTemplate . labels , labels ) ;
502+ assert . deepStrictEqual ( reqOpts . sessionTemplate . labels , labels ) ;
472503 } ) ;
473504
474505 it ( 'should accept session databaseRole' , ( ) => {
@@ -3069,6 +3100,7 @@ describe('Database', () => {
30693100 database . parent . parent = {
30703101 routeToLeaderEnabled : true ,
30713102 directedReadOptions : fakeDirectedReadOptions ,
3103+ options : { } ,
30723104 } ;
30733105
30743106 database . runPartitionedUpdate (
0 commit comments