@@ -18,6 +18,13 @@ import (
18
18
)
19
19
20
20
func TestTemplate_ParseScheduledJob (t * testing.T ) {
21
+ customResources := map [string ]template.S3ObjectLocation {
22
+ "EnvControllerFunction" : {
23
+ Bucket : "my-bucket" ,
24
+ Key : "key" ,
25
+ },
26
+ }
27
+
21
28
testCases := map [string ]struct {
22
29
opts template.WorkloadOpts
23
30
}{
@@ -28,6 +35,7 @@ func TestTemplate_ParseScheduledJob(t *testing.T) {
28
35
AssignPublicIP : template .EnablePublicIP ,
29
36
SubnetsType : template .PublicSubnetsPlacement ,
30
37
},
38
+ CustomResources : customResources ,
31
39
},
32
40
},
33
41
"renders with timeout and no retries" : {
@@ -40,6 +48,7 @@ func TestTemplate_ParseScheduledJob(t *testing.T) {
40
48
SubnetsType : template .PublicSubnetsPlacement ,
41
49
},
42
50
ServiceDiscoveryEndpoint : "test.app.local" ,
51
+ CustomResources : customResources ,
43
52
},
44
53
},
45
54
"renders with options" : {
@@ -53,6 +62,7 @@ func TestTemplate_ParseScheduledJob(t *testing.T) {
53
62
SubnetsType : template .PublicSubnetsPlacement ,
54
63
},
55
64
ServiceDiscoveryEndpoint : "test.app.local" ,
65
+ CustomResources : customResources ,
56
66
},
57
67
},
58
68
"renders with options and addons" : {
@@ -71,6 +81,7 @@ func TestTemplate_ParseScheduledJob(t *testing.T) {
71
81
SubnetsType : template .PublicSubnetsPlacement ,
72
82
},
73
83
ServiceDiscoveryEndpoint : "test.app.local" ,
84
+ CustomResources : customResources ,
74
85
},
75
86
},
76
87
"renders with Windows platform" : {
@@ -84,6 +95,7 @@ func TestTemplate_ParseScheduledJob(t *testing.T) {
84
95
Arch : "x86_64" ,
85
96
},
86
97
ServiceDiscoveryEndpoint : "test.app.local" ,
98
+ CustomResources : customResources ,
87
99
},
88
100
},
89
101
}
@@ -112,6 +124,18 @@ func TestTemplate_ParseLoadBalancedWebService(t *testing.T) {
112
124
defaultHttpHealthCheck := template.HTTPHealthCheckOpts {
113
125
HealthCheckPath : "/" ,
114
126
}
127
+ fakeS3Object := template.S3ObjectLocation {
128
+ Bucket : "my-bucket" ,
129
+ Key : "key" ,
130
+ }
131
+ customResources := map [string ]template.S3ObjectLocation {
132
+ "DynamicDesiredCountFunction" : fakeS3Object ,
133
+ "EnvControllerFunction" : fakeS3Object ,
134
+ "RulePriorityFunction" : fakeS3Object ,
135
+ "NLBCustomDomainFunction" : fakeS3Object ,
136
+ "NLBCertValidatorFunction" : fakeS3Object ,
137
+ }
138
+
115
139
testCases := map [string ]struct {
116
140
opts template.WorkloadOpts
117
141
}{
@@ -123,7 +147,8 @@ func TestTemplate_ParseLoadBalancedWebService(t *testing.T) {
123
147
AssignPublicIP : template .EnablePublicIP ,
124
148
SubnetsType : template .PublicSubnetsPlacement ,
125
149
},
126
- ALBEnabled : true ,
150
+ ALBEnabled : true ,
151
+ CustomResources : customResources ,
127
152
},
128
153
},
129
154
"renders a valid grpc template by default" : {
@@ -135,7 +160,8 @@ func TestTemplate_ParseLoadBalancedWebService(t *testing.T) {
135
160
AssignPublicIP : template .EnablePublicIP ,
136
161
SubnetsType : template .PublicSubnetsPlacement ,
137
162
},
138
- ALBEnabled : true ,
163
+ ALBEnabled : true ,
164
+ CustomResources : customResources ,
139
165
},
140
166
},
141
167
"renders a valid template with addons with no outputs" : {
@@ -150,6 +176,7 @@ func TestTemplate_ParseLoadBalancedWebService(t *testing.T) {
150
176
},
151
177
ServiceDiscoveryEndpoint : "test.app.local" ,
152
178
ALBEnabled : true ,
179
+ CustomResources : customResources ,
153
180
},
154
181
},
155
182
"renders a valid template with addons with outputs" : {
@@ -167,6 +194,7 @@ func TestTemplate_ParseLoadBalancedWebService(t *testing.T) {
167
194
},
168
195
ServiceDiscoveryEndpoint : "test.app.local" ,
169
196
ALBEnabled : true ,
197
+ CustomResources : customResources ,
170
198
},
171
199
},
172
200
"renders a valid template with private subnet placement" : {
@@ -178,6 +206,7 @@ func TestTemplate_ParseLoadBalancedWebService(t *testing.T) {
178
206
},
179
207
ServiceDiscoveryEndpoint : "test.app.local" ,
180
208
ALBEnabled : true ,
209
+ CustomResources : customResources ,
181
210
},
182
211
},
183
212
"renders a valid template with all storage options" : {
@@ -216,7 +245,8 @@ func TestTemplate_ParseLoadBalancedWebService(t *testing.T) {
216
245
},
217
246
},
218
247
},
219
- ALBEnabled : true ,
248
+ ALBEnabled : true ,
249
+ CustomResources : customResources ,
220
250
},
221
251
},
222
252
"renders a valid template with minimal storage options" : {
@@ -250,7 +280,8 @@ func TestTemplate_ParseLoadBalancedWebService(t *testing.T) {
250
280
},
251
281
},
252
282
},
253
- ALBEnabled : true ,
283
+ ALBEnabled : true ,
284
+ CustomResources : customResources ,
254
285
},
255
286
},
256
287
"renders a valid template with ephemeral storage" : {
@@ -264,7 +295,8 @@ func TestTemplate_ParseLoadBalancedWebService(t *testing.T) {
264
295
Storage : & template.StorageOpts {
265
296
Ephemeral : aws .Int (500 ),
266
297
},
267
- ALBEnabled : true ,
298
+ ALBEnabled : true ,
299
+ CustomResources : customResources ,
268
300
},
269
301
},
270
302
"renders a valid template with entrypoint and command overrides" : {
@@ -277,7 +309,8 @@ func TestTemplate_ParseLoadBalancedWebService(t *testing.T) {
277
309
AssignPublicIP : template .EnablePublicIP ,
278
310
SubnetsType : template .PublicSubnetsPlacement ,
279
311
},
280
- ALBEnabled : true ,
312
+ ALBEnabled : true ,
313
+ CustomResources : customResources ,
281
314
},
282
315
},
283
316
"renders a valid template with additional addons parameters" : {
@@ -292,7 +325,8 @@ func TestTemplate_ParseLoadBalancedWebService(t *testing.T) {
292
325
DiscoveryServiceArn:
293
326
Fn::GetAtt: [DiscoveryService, Arn]
294
327
` ,
295
- ALBEnabled : true ,
328
+ ALBEnabled : true ,
329
+ CustomResources : customResources ,
296
330
},
297
331
},
298
332
"renders a valid template with Windows platform" : {
@@ -308,6 +342,7 @@ DiscoveryServiceArn:
308
342
},
309
343
ServiceDiscoveryEndpoint : "test.app.local" ,
310
344
ALBEnabled : true ,
345
+ CustomResources : customResources ,
311
346
},
312
347
},
313
348
}
0 commit comments