File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -641,6 +641,12 @@ export class Bigtable {
641641 }
642642
643643 reqOpts . clusters = arrify ( options . clusters ! ) . reduce ( ( clusters , cluster ) => {
644+ if ( ! cluster . id ) {
645+ throw new Error (
646+ 'A cluster was provided without an `id` property defined.'
647+ ) ;
648+ }
649+
644650 clusters [ cluster . id ! ] = {
645651 location : Cluster . getLocation_ ( this . projectId , cluster . location ! ) ,
646652 serveNodes : cluster . nodes ,
Original file line number Diff line number Diff line change @@ -489,6 +489,23 @@ describe('Bigtable', () => {
489489 done ( ) ;
490490 } ) ;
491491 } ) ;
492+
493+ it ( 'should throw an error if cluster id not provided.' , ( ) => {
494+ const options = {
495+ displayName : 'my-sweet-instance' ,
496+ labels : { env : 'prod' } ,
497+ clusters : [
498+ {
499+ nodes : 3 ,
500+ location : 'us-central1-b' ,
501+ storage : 'ssd' ,
502+ } ,
503+ ] ,
504+ } ;
505+ assert . throws ( ( ) => {
506+ bigtable . createInstance ( INSTANCE_ID , options ) ;
507+ } , / A c l u s t e r w a s p r o v i d e d w i t h o u t a n ` i d ` p r o p e r t y d e f i n e d \. / ) ;
508+ } ) ;
492509 } ) ;
493510
494511 describe ( 'getInstances' , ( ) => {
You can’t perform that action at this time.
0 commit comments