@@ -99,7 +99,7 @@ describe('Scf', () => {
99
99
handler : 'sl_handler.handler' ,
100
100
runtime : 'Nodejs12.16' ,
101
101
region : 'ap-guangzhou' ,
102
- description : 'Created by Serverless Framework ' ,
102
+ description : 'Created by Serverless' ,
103
103
memorySize : 256 ,
104
104
timeout : 20 ,
105
105
needSetTraffic : true ,
@@ -170,96 +170,69 @@ describe('Scf', () => {
170
170
test ( 'deploy' , async ( ) => {
171
171
await sleep ( 3000 ) ;
172
172
outputs = await scf . deploy ( inputs ) ;
173
- expect ( outputs ) . toEqual ( {
174
- Qualifier : '$LATEST' ,
175
- Description : 'Created by Serverless Framework' ,
176
- Timeout : inputs . timeout ,
177
- InitTimeout : expect . any ( Number ) ,
178
- MemorySize : inputs . memorySize ,
179
- Runtime : inputs . runtime ,
180
- VpcConfig : { VpcId : vpcConfig . vpcId , SubnetId : vpcConfig . subnetId } ,
181
- Environment : {
182
- Variables : [
183
- {
184
- Key : 'TEST' ,
185
- Value : 'value' ,
186
- } ,
187
- ] ,
188
- } ,
189
- Handler : inputs . handler ,
190
- AsyncRunEnable : 'FALSE' ,
191
- LogType : expect . any ( String ) ,
192
- TraceEnable : 'FALSE' ,
193
- UseGpu : 'FALSE' ,
194
- Role : inputs . role ,
195
- CodeSize : 0 ,
196
- FunctionVersion : '$LATEST' ,
197
- FunctionName : inputs . name ,
198
- Namespace : 'test' ,
199
- InstallDependency : 'FALSE' ,
200
- Status : 'Active' ,
201
- // Status: expect.any(String),
202
- AvailableStatus : 'Available' ,
203
- StatusDesc : expect . any ( String ) ,
204
- FunctionId : expect . stringContaining ( 'lam-' ) ,
205
- L5Enable : 'FALSE' ,
206
- EipConfig : { EipFixed : 'TRUE' , Eips : expect . any ( Array ) } ,
207
- ModTime : expect . any ( String ) ,
208
- AddTime : expect . any ( String ) ,
209
- Layers : [
173
+ expect ( outputs . Qualifier ) . toBe ( '$LATEST' ) ;
174
+ expect ( outputs . Description ) . toBe ( 'Created by Serverless' ) ;
175
+ expect ( outputs . Timeout ) . toBe ( inputs . timeout ) ;
176
+ expect ( outputs . MemorySize ) . toBe ( inputs . memorySize ) ;
177
+ expect ( outputs . Runtime ) . toBe ( inputs . runtime ) ;
178
+ expect ( outputs . Handler ) . toBe ( inputs . handler ) ;
179
+ expect ( outputs . Role ) . toBe ( inputs . role ) ;
180
+ expect ( outputs . VpcConfig ) . toEqual ( { VpcId : vpcConfig . vpcId , SubnetId : vpcConfig . subnetId } ) ;
181
+ expect ( outputs . FunctionName ) . toBe ( inputs . name ) ;
182
+ expect ( outputs . Environment ) . toEqual ( {
183
+ Variables : [
210
184
{
211
- LayerName : layerInputs . name ,
212
- LayerVersion : expect . any ( Number ) ,
213
- CompatibleRuntimes : layerInputs . runtimes ,
214
- Description : layerInputs . description ,
215
- LicenseInfo : '' ,
216
- AddTime : expect . any ( String ) ,
217
- Status : 'Active' ,
218
- Src : 'Default' ,
185
+ Key : 'TEST' ,
186
+ Value : 'value' ,
219
187
} ,
220
188
] ,
221
- DeadLetterConfig : { Type : '' , Name : '' , FilterType : '' } ,
222
- OnsEnable : 'FALSE' ,
223
- PublicNetConfig : {
224
- PublicNetStatus : 'ENABLE' ,
225
- EipConfig : { EipStatus : 'ENABLE' , EipAddress : expect . any ( Array ) } ,
189
+ } ) ;
190
+ expect ( outputs . AsyncRunEnable ) . toBe ( 'FALSE' ) ;
191
+ expect ( outputs . Status ) . toBe ( 'Active' ) ;
192
+ expect ( outputs . EipConfig ) . toEqual ( { EipFixed : 'TRUE' , Eips : expect . any ( Array ) } ) ;
193
+ expect ( outputs . Layers ) . toEqual ( [
194
+ {
195
+ LayerName : layerInputs . name ,
196
+ LayerVersion : expect . any ( Number ) ,
197
+ CompatibleRuntimes : layerInputs . runtimes ,
198
+ Description : layerInputs . description ,
199
+ LicenseInfo : '' ,
200
+ AddTime : expect . any ( String ) ,
201
+ Status : 'Active' ,
202
+ Src : 'Default' ,
203
+ } ,
204
+ ] ) ;
205
+ expect ( outputs . PublicNetConfig ) . toEqual ( {
206
+ PublicNetStatus : 'ENABLE' ,
207
+ EipConfig : { EipStatus : 'ENABLE' , EipAddress : expect . any ( Array ) } ,
208
+ } ) ;
209
+ expect ( outputs . Tags ) . toEqual ( [
210
+ {
211
+ Key : 'test' ,
212
+ Value : 'test' ,
226
213
} ,
227
- Triggers : expect . any ( Array ) ,
228
- ClsLogsetId : expect . any ( String ) ,
229
- ClsTopicId : expect . any ( String ) ,
230
- CodeInfo : '' ,
231
- CodeResult : 'success' ,
232
- CodeError : '' ,
233
- ErrNo : 0 ,
234
- Tags : [
214
+ ] ) ;
215
+ expect ( outputs . CfsConfig ) . toEqual ( {
216
+ CfsInsList : [
235
217
{
236
- Key : 'test' ,
237
- Value : 'test' ,
218
+ UserId : '10000' ,
219
+ UserGroupId : '10000' ,
220
+ CfsId : inputs . cfs [ 0 ] . cfsId ,
221
+ MountInsId : inputs . cfs [ 0 ] . cfsId ,
222
+ LocalMountDir : inputs . cfs [ 0 ] . localMountDir ,
223
+ RemoteMountDir : inputs . cfs [ 0 ] . remoteMountDir ,
224
+ IpAddress : expect . any ( String ) ,
225
+ MountVpcId : inputs . vpcConfig . vpcId ,
226
+ MountSubnetId : inputs . vpcConfig . subnetId ,
238
227
} ,
239
228
] ,
240
- AccessInfo : { Host : '' , Vip : '' } ,
241
- Type : 'Event' ,
242
- CfsConfig : {
243
- CfsInsList : [
244
- {
245
- UserId : '10000' ,
246
- UserGroupId : '10000' ,
247
- CfsId : inputs . cfs [ 0 ] . cfsId ,
248
- MountInsId : inputs . cfs [ 0 ] . cfsId ,
249
- LocalMountDir : inputs . cfs [ 0 ] . localMountDir ,
250
- RemoteMountDir : inputs . cfs [ 0 ] . remoteMountDir ,
251
- IpAddress : expect . any ( String ) ,
252
- MountVpcId : inputs . vpcConfig . vpcId ,
253
- MountSubnetId : inputs . vpcConfig . subnetId ,
254
- } ,
255
- ] ,
256
- } ,
257
- StatusReasons : [ ] ,
258
- RequestId : expect . any ( String ) ,
259
- LastVersion : '1' ,
260
- Traffic : inputs . traffic ,
261
- ConfigTrafficVersion : '1' ,
262
229
} ) ;
230
+ expect ( outputs . LastVersion ) . toBe ( '1' ) ;
231
+ expect ( outputs . Traffic ) . toBe ( inputs . traffic ) ;
232
+ expect ( outputs . ConfigTrafficVersion ) . toBe ( '1' ) ;
233
+ expect ( outputs . InstallDependency ) . toBe ( 'FALSE' ) ;
234
+ expect ( outputs . AsyncRunEnable ) . toBe ( 'FALSE' ) ;
235
+ expect ( outputs . TraceEnable ) . toBe ( 'FALSE' ) ;
263
236
264
237
// expect triggers result
265
238
expect ( outputs . Triggers ) . toEqual ( [
@@ -355,96 +328,69 @@ describe('Scf', () => {
355
328
test ( 'update' , async ( ) => {
356
329
await sleep ( 3000 ) ;
357
330
outputs = await scf . deploy ( inputs ) ;
358
- expect ( outputs ) . toEqual ( {
359
- Qualifier : '$LATEST' ,
360
- Description : 'Created by Serverless Framework' ,
361
- Timeout : inputs . timeout ,
362
- InitTimeout : expect . any ( Number ) ,
363
- MemorySize : inputs . memorySize ,
364
- Runtime : inputs . runtime ,
365
- VpcConfig : { VpcId : vpcConfig . vpcId , SubnetId : vpcConfig . subnetId } ,
366
- Environment : {
367
- Variables : [
368
- {
369
- Key : 'TEST' ,
370
- Value : 'value' ,
371
- } ,
372
- ] ,
373
- } ,
374
- Handler : inputs . handler ,
375
- AsyncRunEnable : 'FALSE' ,
376
- LogType : expect . any ( String ) ,
377
- TraceEnable : 'FALSE' ,
378
- UseGpu : 'FALSE' ,
379
- Role : inputs . role ,
380
- CodeSize : 0 ,
381
- FunctionVersion : '$LATEST' ,
382
- FunctionName : inputs . name ,
383
- Namespace : 'test' ,
384
- InstallDependency : 'FALSE' ,
385
- Status : 'Active' ,
386
- // Status: expect.any(String),
387
- AvailableStatus : 'Available' ,
388
- StatusDesc : expect . any ( String ) ,
389
- FunctionId : expect . stringContaining ( 'lam-' ) ,
390
- L5Enable : 'FALSE' ,
391
- EipConfig : { EipFixed : 'TRUE' , Eips : expect . any ( Array ) } ,
392
- ModTime : expect . any ( String ) ,
393
- AddTime : expect . any ( String ) ,
394
- Layers : [
331
+ expect ( outputs . Qualifier ) . toBe ( '$LATEST' ) ;
332
+ expect ( outputs . Description ) . toBe ( 'Created by Serverless' ) ;
333
+ expect ( outputs . Timeout ) . toBe ( inputs . timeout ) ;
334
+ expect ( outputs . MemorySize ) . toBe ( inputs . memorySize ) ;
335
+ expect ( outputs . Runtime ) . toBe ( inputs . runtime ) ;
336
+ expect ( outputs . Handler ) . toBe ( inputs . handler ) ;
337
+ expect ( outputs . Role ) . toBe ( inputs . role ) ;
338
+ expect ( outputs . VpcConfig ) . toEqual ( { VpcId : vpcConfig . vpcId , SubnetId : vpcConfig . subnetId } ) ;
339
+ expect ( outputs . FunctionName ) . toBe ( inputs . name ) ;
340
+ expect ( outputs . Environment ) . toEqual ( {
341
+ Variables : [
395
342
{
396
- LayerName : layerInputs . name ,
397
- LayerVersion : expect . any ( Number ) ,
398
- CompatibleRuntimes : layerInputs . runtimes ,
399
- Description : layerInputs . description ,
400
- LicenseInfo : '' ,
401
- AddTime : expect . any ( String ) ,
402
- Status : 'Active' ,
403
- Src : 'Default' ,
343
+ Key : 'TEST' ,
344
+ Value : 'value' ,
404
345
} ,
405
346
] ,
406
- DeadLetterConfig : { Type : '' , Name : '' , FilterType : '' } ,
407
- OnsEnable : 'FALSE' ,
408
- PublicNetConfig : {
409
- PublicNetStatus : 'ENABLE' ,
410
- EipConfig : { EipStatus : 'ENABLE' , EipAddress : expect . any ( Array ) } ,
347
+ } ) ;
348
+ expect ( outputs . AsyncRunEnable ) . toBe ( 'FALSE' ) ;
349
+ expect ( outputs . Status ) . toBe ( 'Active' ) ;
350
+ expect ( outputs . EipConfig ) . toEqual ( { EipFixed : 'TRUE' , Eips : expect . any ( Array ) } ) ;
351
+ expect ( outputs . Layers ) . toEqual ( [
352
+ {
353
+ LayerName : layerInputs . name ,
354
+ LayerVersion : expect . any ( Number ) ,
355
+ CompatibleRuntimes : layerInputs . runtimes ,
356
+ Description : layerInputs . description ,
357
+ LicenseInfo : '' ,
358
+ AddTime : expect . any ( String ) ,
359
+ Status : 'Active' ,
360
+ Src : 'Default' ,
361
+ } ,
362
+ ] ) ;
363
+ expect ( outputs . PublicNetConfig ) . toEqual ( {
364
+ PublicNetStatus : 'ENABLE' ,
365
+ EipConfig : { EipStatus : 'ENABLE' , EipAddress : expect . any ( Array ) } ,
366
+ } ) ;
367
+ expect ( outputs . Tags ) . toEqual ( [
368
+ {
369
+ Key : 'test' ,
370
+ Value : 'test' ,
411
371
} ,
412
- Triggers : expect . any ( Array ) ,
413
- ClsLogsetId : expect . any ( String ) ,
414
- ClsTopicId : expect . any ( String ) ,
415
- CodeInfo : '' ,
416
- CodeResult : 'success' ,
417
- CodeError : '' ,
418
- ErrNo : 0 ,
419
- Tags : [
372
+ ] ) ;
373
+ expect ( outputs . CfsConfig ) . toEqual ( {
374
+ CfsInsList : [
420
375
{
421
- Key : 'test' ,
422
- Value : 'test' ,
376
+ UserId : '10000' ,
377
+ UserGroupId : '10000' ,
378
+ CfsId : inputs . cfs [ 0 ] . cfsId ,
379
+ MountInsId : inputs . cfs [ 0 ] . cfsId ,
380
+ LocalMountDir : inputs . cfs [ 0 ] . localMountDir ,
381
+ RemoteMountDir : inputs . cfs [ 0 ] . remoteMountDir ,
382
+ IpAddress : expect . any ( String ) ,
383
+ MountVpcId : inputs . vpcConfig . vpcId ,
384
+ MountSubnetId : inputs . vpcConfig . subnetId ,
423
385
} ,
424
386
] ,
425
- AccessInfo : { Host : '' , Vip : '' } ,
426
- Type : 'Event' ,
427
- CfsConfig : {
428
- CfsInsList : [
429
- {
430
- UserId : '10000' ,
431
- UserGroupId : '10000' ,
432
- CfsId : inputs . cfs [ 0 ] . cfsId ,
433
- MountInsId : inputs . cfs [ 0 ] . cfsId ,
434
- LocalMountDir : inputs . cfs [ 0 ] . localMountDir ,
435
- RemoteMountDir : inputs . cfs [ 0 ] . remoteMountDir ,
436
- IpAddress : expect . any ( String ) ,
437
- MountVpcId : inputs . vpcConfig . vpcId ,
438
- MountSubnetId : inputs . vpcConfig . subnetId ,
439
- } ,
440
- ] ,
441
- } ,
442
- StatusReasons : [ ] ,
443
- RequestId : expect . any ( String ) ,
444
- LastVersion : '2' ,
445
- Traffic : inputs . traffic ,
446
- ConfigTrafficVersion : '2' ,
447
387
} ) ;
388
+ expect ( outputs . LastVersion ) . toBe ( '2' ) ;
389
+ expect ( outputs . Traffic ) . toBe ( inputs . traffic ) ;
390
+ expect ( outputs . ConfigTrafficVersion ) . toBe ( '2' ) ;
391
+ expect ( outputs . InstallDependency ) . toBe ( 'FALSE' ) ;
392
+ expect ( outputs . AsyncRunEnable ) . toBe ( 'FALSE' ) ;
393
+ expect ( outputs . TraceEnable ) . toBe ( 'FALSE' ) ;
448
394
449
395
// expect triggers result
450
396
expect ( outputs . Triggers ) . toEqual ( [
0 commit comments