@@ -7,7 +7,7 @@ describe('Scf - singapore', () => {
7
7
SecretId : process . env . TENCENT_SECRET_ID ,
8
8
SecretKey : process . env . TENCENT_SECRET_KEY ,
9
9
} ;
10
- const scf = new Scf ( credentials , 'ap-singapore ' ) ;
10
+ const scf = new Scf ( credentials , 'ap-guangzhou ' ) ;
11
11
12
12
const triggers = {
13
13
apigw : {
@@ -41,15 +41,15 @@ describe('Scf - singapore', () => {
41
41
// name: `serverless-test-${Date.now()}`,
42
42
name : `serverless-test-fixed` ,
43
43
code : {
44
- bucket : 'test-singapore' ,
45
- object : 'express_code .zip' ,
44
+ bucket : process . env . BUCKET ,
45
+ object : 'express_code_pure .zip' ,
46
46
} ,
47
47
namespace : 'test' ,
48
48
role : 'SCF_QcsRole' ,
49
49
handler : 'sl_handler.handler' ,
50
50
runtime : 'Nodejs12.16' ,
51
- region : 'ap-singapore ' ,
52
- description : 'Created by Serverless Framework ' ,
51
+ region : 'ap-guangzhou ' ,
52
+ description : 'Created by Serverless' ,
53
53
memorySize : 256 ,
54
54
timeout : 20 ,
55
55
tags : {
@@ -61,143 +61,34 @@ describe('Scf - singapore', () => {
61
61
} ,
62
62
} ,
63
63
events,
64
+ installDependency : true ,
64
65
} ;
65
66
66
67
let outputs ;
67
68
68
69
test ( 'should deploy SCF success' , async ( ) => {
69
70
await sleep ( 3000 ) ;
70
71
outputs = await scf . deploy ( inputs ) ;
71
- expect ( outputs ) . toEqual ( {
72
- Qualifier : '$LATEST' ,
73
- Description : 'Created by Serverless Framework' ,
74
- Timeout : inputs . timeout ,
75
- InitTimeout : expect . any ( Number ) ,
76
- MemorySize : inputs . memorySize ,
77
- Runtime : inputs . runtime ,
78
- VpcConfig : { VpcId : '' , SubnetId : '' } ,
79
- Environment : {
80
- Variables : [
81
- {
82
- Key : 'TEST' ,
83
- Value : 'value' ,
84
- } ,
85
- ] ,
86
- } ,
87
- Handler : inputs . handler ,
88
- AsyncRunEnable : 'FALSE' ,
89
- LogType : expect . any ( String ) ,
90
- TraceEnable : 'FALSE' ,
91
- UseGpu : 'FALSE' ,
92
- Role : inputs . role ,
93
- CodeSize : 0 ,
94
- FunctionVersion : '$LATEST' ,
95
- FunctionName : inputs . name ,
96
- Namespace : 'test' ,
97
- InstallDependency : 'FALSE' ,
98
- Status : 'Active' ,
99
- AvailableStatus : 'Available' ,
100
- StatusDesc : expect . any ( String ) ,
101
- FunctionId : expect . stringContaining ( 'lam-' ) ,
102
- L5Enable : 'FALSE' ,
103
- EipConfig : { EipFixed : 'FALSE' , Eips : expect . any ( Array ) } ,
104
- ModTime : expect . any ( String ) ,
105
- AddTime : expect . any ( String ) ,
106
- Layers : [ ] ,
107
- DeadLetterConfig : { Type : '' , Name : '' , FilterType : '' } ,
108
- OnsEnable : 'FALSE' ,
109
- PublicNetConfig : {
110
- PublicNetStatus : 'ENABLE' ,
111
- EipConfig : { EipStatus : 'DISABLE' , EipAddress : expect . any ( Array ) } ,
112
- } ,
113
- Triggers : expect . any ( Array ) ,
114
- ClsLogsetId : expect . any ( String ) ,
115
- ClsTopicId : expect . any ( String ) ,
116
- CodeInfo : '' ,
117
- CodeResult : 'success' ,
118
- CodeError : '' ,
119
- ErrNo : 0 ,
120
- Tags : [
121
- {
122
- Key : 'test' ,
123
- Value : 'test' ,
124
- } ,
125
- ] ,
126
- AccessInfo : { Host : '' , Vip : '' } ,
127
- Type : 'Event' ,
128
- CfsConfig : {
129
- CfsInsList : [ ] ,
130
- } ,
131
- StatusReasons : [ ] ,
132
- RequestId : expect . any ( String ) ,
133
- } ) ;
72
+ expect ( outputs . FunctionName ) . toBe ( inputs . name ) ;
73
+ expect ( outputs . Qualifier ) . toBe ( '$LATEST' ) ;
74
+ expect ( outputs . Description ) . toBe ( 'Created by Serverless' ) ;
75
+ expect ( outputs . Timeout ) . toBe ( inputs . timeout ) ;
76
+ expect ( outputs . MemorySize ) . toBe ( inputs . memorySize ) ;
77
+ expect ( outputs . Runtime ) . toBe ( inputs . runtime ) ;
78
+ expect ( outputs . InstallDependency ) . toBe ( 'TRUE' ) ;
79
+ expect ( outputs . Role ) . toBe ( inputs . role ) ;
134
80
} ) ;
135
81
test ( 'should update SCF success' , async ( ) => {
136
82
await sleep ( 3000 ) ;
137
83
outputs = await scf . deploy ( inputs ) ;
138
- expect ( outputs ) . toEqual ( {
139
- Qualifier : '$LATEST' ,
140
- Description : 'Created by Serverless Framework' ,
141
- Timeout : inputs . timeout ,
142
- InitTimeout : expect . any ( Number ) ,
143
- MemorySize : inputs . memorySize ,
144
- Runtime : inputs . runtime ,
145
- VpcConfig : { VpcId : '' , SubnetId : '' } ,
146
- Environment : {
147
- Variables : [
148
- {
149
- Key : 'TEST' ,
150
- Value : 'value' ,
151
- } ,
152
- ] ,
153
- } ,
154
- Handler : inputs . handler ,
155
- AsyncRunEnable : 'FALSE' ,
156
- LogType : expect . any ( String ) ,
157
- TraceEnable : 'FALSE' ,
158
- UseGpu : 'FALSE' ,
159
- Role : inputs . role ,
160
- CodeSize : 0 ,
161
- FunctionVersion : '$LATEST' ,
162
- FunctionName : inputs . name ,
163
- Namespace : 'test' ,
164
- InstallDependency : 'FALSE' ,
165
- Status : 'Active' ,
166
- AvailableStatus : 'Available' ,
167
- StatusDesc : expect . any ( String ) ,
168
- FunctionId : expect . stringContaining ( 'lam-' ) ,
169
- L5Enable : 'FALSE' ,
170
- EipConfig : { EipFixed : 'FALSE' , Eips : expect . any ( Array ) } ,
171
- ModTime : expect . any ( String ) ,
172
- AddTime : expect . any ( String ) ,
173
- Layers : [ ] ,
174
- DeadLetterConfig : { Type : '' , Name : '' , FilterType : '' } ,
175
- OnsEnable : 'FALSE' ,
176
- PublicNetConfig : {
177
- PublicNetStatus : 'ENABLE' ,
178
- EipConfig : { EipStatus : 'DISABLE' , EipAddress : expect . any ( Array ) } ,
179
- } ,
180
- Triggers : expect . any ( Array ) ,
181
- ClsLogsetId : expect . any ( String ) ,
182
- ClsTopicId : expect . any ( String ) ,
183
- CodeInfo : '' ,
184
- CodeResult : 'success' ,
185
- CodeError : '' ,
186
- ErrNo : 0 ,
187
- Tags : [
188
- {
189
- Key : 'test' ,
190
- Value : 'test' ,
191
- } ,
192
- ] ,
193
- AccessInfo : { Host : '' , Vip : '' } ,
194
- Type : 'Event' ,
195
- CfsConfig : {
196
- CfsInsList : [ ] ,
197
- } ,
198
- StatusReasons : [ ] ,
199
- RequestId : expect . any ( String ) ,
200
- } ) ;
84
+ expect ( outputs . FunctionName ) . toBe ( inputs . name ) ;
85
+ expect ( outputs . Qualifier ) . toBe ( '$LATEST' ) ;
86
+ expect ( outputs . Description ) . toBe ( 'Created by Serverless' ) ;
87
+ expect ( outputs . Timeout ) . toBe ( inputs . timeout ) ;
88
+ expect ( outputs . MemorySize ) . toBe ( inputs . memorySize ) ;
89
+ expect ( outputs . Runtime ) . toBe ( inputs . runtime ) ;
90
+ expect ( outputs . InstallDependency ) . toBe ( 'TRUE' ) ;
91
+ expect ( outputs . Role ) . toBe ( inputs . role ) ;
201
92
} ) ;
202
93
test ( 'should remove Scf success' , async ( ) => {
203
94
const res = await scf . remove ( {
0 commit comments