@@ -157,6 +157,54 @@ spec:
157
157
name: default-dev-foo-nginx-0
158
158
name: default-dev-foo-nginx-0
159
159
status: {}
160
+ `
161
+ deployWithProbe := `apiVersion: apps/v1
162
+ kind: Deployment
163
+ metadata:
164
+ creationTimestamp: null
165
+ labels:
166
+ app.kubernetes.io/name: foo
167
+ app.kubernetes.io/part-of: default
168
+ service-workload-type: Deployment
169
+ name: default-dev-foo
170
+ namespace: default
171
+ spec:
172
+ replicas: 4
173
+ selector:
174
+ matchLabels:
175
+ app.kubernetes.io/name: foo
176
+ app.kubernetes.io/part-of: default
177
+ strategy: {}
178
+ template:
179
+ metadata:
180
+ creationTimestamp: null
181
+ labels:
182
+ app.kubernetes.io/name: foo
183
+ app.kubernetes.io/part-of: default
184
+ service-workload-type: Deployment
185
+ spec:
186
+ containers:
187
+ - image: nginx:v1
188
+ lifecycle:
189
+ postStart:
190
+ exec:
191
+ command:
192
+ - /bin/true
193
+ name: nginx
194
+ readinessProbe:
195
+ tcp:
196
+ host: "localhost"
197
+ port: 8888
198
+ resources: {}
199
+ volumeMounts:
200
+ - mountPath: /tmp
201
+ name: default-dev-foo-nginx-0
202
+ volumes:
203
+ - configMap:
204
+ defaultMode: 511
205
+ name: default-dev-foo-nginx-0
206
+ name: default-dev-foo-nginx-0
207
+ status: {}
160
208
`
161
209
r2 := new (int32 )
162
210
* r2 = 2
@@ -263,6 +311,61 @@ status: {}
263
311
wantErr : false ,
264
312
want : []string {cm , deploy , deploySvc },
265
313
},
314
+ {
315
+ name : "DeploymentWithProbe" ,
316
+ fields : fields {
317
+ project : "default" ,
318
+ stack : "dev" ,
319
+ appName : "foo" ,
320
+ service : & v1.Service {
321
+ Base : v1.Base {
322
+ Containers : map [string ]v1.Container {
323
+ "nginx" : {
324
+ Image : "nginx:v1" ,
325
+ Files : map [string ]v1.FileSpec {
326
+ "/tmp/example.txt" : {
327
+ Content : "some file contents" ,
328
+ Mode : "0777" ,
329
+ },
330
+ },
331
+ ReadinessProbe : & v1.Probe {ProbeHandler : & v1.ProbeHandler {
332
+ TypeWrapper : v1.TypeWrapper {Type : v1 .TypeTCP },
333
+ ExecAction : nil ,
334
+ HTTPGetAction : nil ,
335
+ TCPSocketAction : & v1.TCPSocketAction {URL : "localhost:8888" },
336
+ }},
337
+ Lifecycle : & v1.Lifecycle {
338
+ PostStart : & v1.LifecycleHandler {
339
+ TypeWrapper : v1.TypeWrapper {Type : v1 .TypeExec },
340
+ ExecAction : & v1.ExecAction {Command : []string {
341
+ "/bin/true" ,
342
+ }},
343
+ HTTPGetAction : nil ,
344
+ },
345
+ },
346
+ },
347
+ },
348
+ },
349
+ Ports : []v1.Port {
350
+ {
351
+ Port : 80 ,
352
+ Protocol : "TCP" ,
353
+ },
354
+ },
355
+ },
356
+ serviceConfig : v1.GenericConfig {
357
+ "replicas" : 4 ,
358
+ "labels" : v1.GenericConfig {
359
+ "service-workload-type" : "Deployment" ,
360
+ },
361
+ },
362
+ },
363
+ args : args {
364
+ spec : & v1.Spec {},
365
+ },
366
+ wantErr : false ,
367
+ want : []string {cm , deployWithProbe , deploySvc },
368
+ },
266
369
}
267
370
for _ , tt := range tests {
268
371
t .Run (tt .name , func (t * testing.T ) {
0 commit comments