@@ -683,5 +683,70 @@ describe('CompileFunctions', () => {
683
683
) . toEqual ( compiledResources ) ;
684
684
} ) ;
685
685
} ) ;
686
+
687
+ it ( 'should not require max instances on each function configuration' , ( ) => {
688
+ googlePackage . serverless . service . functions = {
689
+ func1 : {
690
+ handler : 'func1' ,
691
+ memorySize : 128 ,
692
+ runtime : 'nodejs8' ,
693
+ vpc : 'projects/pg-us-n-app-123456/locations/us-central1/connectors/my-vpc' ,
694
+ events : [ { http : 'foo' } ] ,
695
+ } ,
696
+ func2 : {
697
+ handler : 'func2' ,
698
+ memorySize : 128 ,
699
+ runtime : 'nodejs8' ,
700
+ maxInstances : 10 ,
701
+ vpc : 'projects/pg-us-n-app-123456/locations/us-central1/connectors/my-vpc' ,
702
+ events : [ { http : 'bar' } ] ,
703
+ } ,
704
+ } ;
705
+
706
+ const compiledResources = [
707
+ {
708
+ type : 'cloudfunctions.v1beta2.function' ,
709
+ name : 'my-service-dev-func1' ,
710
+ properties : {
711
+ location : 'us-central1' ,
712
+ runtime : 'nodejs8' ,
713
+ function : 'func1' ,
714
+ availableMemoryMb : 128 ,
715
+ timeout : '60s' ,
716
+ sourceArchiveUrl : 'gs://sls-my-service-dev-12345678/some-path/artifact.zip' ,
717
+ httpsTrigger : {
718
+ url : 'foo' ,
719
+ } ,
720
+ labels : { } ,
721
+ vpcConnector : 'projects/pg-us-n-app-123456/locations/us-central1/connectors/my-vpc' ,
722
+ } ,
723
+ } ,
724
+ {
725
+ type : 'cloudfunctions.v1beta2.function' ,
726
+ name : 'my-service-dev-func2' ,
727
+ properties : {
728
+ location : 'us-central1' ,
729
+ runtime : 'nodejs8' ,
730
+ function : 'func2' ,
731
+ availableMemoryMb : 128 ,
732
+ timeout : '60s' ,
733
+ maxInstances : 10 ,
734
+ sourceArchiveUrl : 'gs://sls-my-service-dev-12345678/some-path/artifact.zip' ,
735
+ httpsTrigger : {
736
+ url : 'bar' ,
737
+ } ,
738
+ labels : { } ,
739
+ vpcConnector : 'projects/pg-us-n-app-123456/locations/us-central1/connectors/my-vpc' ,
740
+ } ,
741
+ } ,
742
+ ] ;
743
+
744
+ return googlePackage . compileFunctions ( ) . then ( ( ) => {
745
+ expect ( consoleLogStub . called ) . toEqual ( true ) ;
746
+ expect (
747
+ googlePackage . serverless . service . provider . compiledConfigurationTemplate . resources
748
+ ) . toEqual ( compiledResources ) ;
749
+ } ) ;
750
+ } ) ;
686
751
} ) ;
687
752
} ) ;
0 commit comments