@@ -256,6 +256,20 @@ func TestUpdatePodStatus(t *testing.T) {
256
256
Running : & v1.ContainerStateRunning {},
257
257
},
258
258
}
259
+ notStartedNoReadiness := v1.ContainerStatus {
260
+ Name : "not_started_container_no_readiness" ,
261
+ ContainerID : "test://not_started_container_no_readiness_id" ,
262
+ State : v1.ContainerState {
263
+ Running : & v1.ContainerStateRunning {},
264
+ },
265
+ }
266
+ startedNoReadiness := v1.ContainerStatus {
267
+ Name : "started_container_no_readiness" ,
268
+ ContainerID : "test://started_container_no_readiness_id" ,
269
+ State : v1.ContainerState {
270
+ Running : & v1.ContainerStateRunning {},
271
+ },
272
+ }
259
273
terminated := v1.ContainerStatus {
260
274
Name : "terminated_container" ,
261
275
ContainerID : "test://terminated_container_id" ,
@@ -266,7 +280,7 @@ func TestUpdatePodStatus(t *testing.T) {
266
280
podStatus := v1.PodStatus {
267
281
Phase : v1 .PodRunning ,
268
282
ContainerStatuses : []v1.ContainerStatus {
269
- unprobed , probedReady , probedPending , probedUnready , terminated ,
283
+ unprobed , probedReady , probedPending , probedUnready , notStartedNoReadiness , startedNoReadiness , terminated ,
270
284
},
271
285
}
272
286
@@ -275,24 +289,29 @@ func TestUpdatePodStatus(t *testing.T) {
275
289
276
290
// Setup probe "workers" and cached results.
277
291
m .workers = map [probeKey ]* worker {
278
- {testPodUID , unprobed .Name , liveness }: {},
279
- {testPodUID , probedReady .Name , readiness }: {},
280
- {testPodUID , probedPending .Name , readiness }: {},
281
- {testPodUID , probedUnready .Name , readiness }: {},
282
- {testPodUID , terminated .Name , readiness }: {},
292
+ {testPodUID , unprobed .Name , liveness }: {},
293
+ {testPodUID , probedReady .Name , readiness }: {},
294
+ {testPodUID , probedPending .Name , readiness }: {},
295
+ {testPodUID , probedUnready .Name , readiness }: {},
296
+ {testPodUID , notStartedNoReadiness .Name , startup }: {},
297
+ {testPodUID , startedNoReadiness .Name , startup }: {},
298
+ {testPodUID , terminated .Name , readiness }: {},
283
299
}
284
300
m .readinessManager .Set (kubecontainer .ParseContainerID (probedReady .ContainerID ), results .Success , & v1.Pod {})
285
301
m .readinessManager .Set (kubecontainer .ParseContainerID (probedUnready .ContainerID ), results .Failure , & v1.Pod {})
302
+ m .startupManager .Set (kubecontainer .ParseContainerID (startedNoReadiness .ContainerID ), results .Success , & v1.Pod {})
286
303
m .readinessManager .Set (kubecontainer .ParseContainerID (terminated .ContainerID ), results .Success , & v1.Pod {})
287
304
288
305
m .UpdatePodStatus (testPodUID , & podStatus )
289
306
290
307
expectedReadiness := map [probeKey ]bool {
291
- {testPodUID , unprobed .Name , readiness }: true ,
292
- {testPodUID , probedReady .Name , readiness }: true ,
293
- {testPodUID , probedPending .Name , readiness }: false ,
294
- {testPodUID , probedUnready .Name , readiness }: false ,
295
- {testPodUID , terminated .Name , readiness }: false ,
308
+ {testPodUID , unprobed .Name , readiness }: true ,
309
+ {testPodUID , probedReady .Name , readiness }: true ,
310
+ {testPodUID , probedPending .Name , readiness }: false ,
311
+ {testPodUID , probedUnready .Name , readiness }: false ,
312
+ {testPodUID , notStartedNoReadiness .Name , readiness }: false ,
313
+ {testPodUID , startedNoReadiness .Name , readiness }: true ,
314
+ {testPodUID , terminated .Name , readiness }: false ,
296
315
}
297
316
for _ , c := range podStatus .ContainerStatuses {
298
317
expected , ok := expectedReadiness [probeKey {testPodUID , c .Name , readiness }]
0 commit comments