mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 18:31:15 +00:00
Merge pull request #92239 from matthyx/more-tests
Add tests covering startup probe without readiness
This commit is contained in:
commit
b0e974e1aa
@ -256,6 +256,20 @@ func TestUpdatePodStatus(t *testing.T) {
|
|||||||
Running: &v1.ContainerStateRunning{},
|
Running: &v1.ContainerStateRunning{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
notStartedNoReadiness := v1.ContainerStatus{
|
||||||
|
Name: "not_started_container_no_readiness",
|
||||||
|
ContainerID: "test://not_started_container_no_readiness_id",
|
||||||
|
State: v1.ContainerState{
|
||||||
|
Running: &v1.ContainerStateRunning{},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
startedNoReadiness := v1.ContainerStatus{
|
||||||
|
Name: "started_container_no_readiness",
|
||||||
|
ContainerID: "test://started_container_no_readiness_id",
|
||||||
|
State: v1.ContainerState{
|
||||||
|
Running: &v1.ContainerStateRunning{},
|
||||||
|
},
|
||||||
|
}
|
||||||
terminated := v1.ContainerStatus{
|
terminated := v1.ContainerStatus{
|
||||||
Name: "terminated_container",
|
Name: "terminated_container",
|
||||||
ContainerID: "test://terminated_container_id",
|
ContainerID: "test://terminated_container_id",
|
||||||
@ -266,7 +280,7 @@ func TestUpdatePodStatus(t *testing.T) {
|
|||||||
podStatus := v1.PodStatus{
|
podStatus := v1.PodStatus{
|
||||||
Phase: v1.PodRunning,
|
Phase: v1.PodRunning,
|
||||||
ContainerStatuses: []v1.ContainerStatus{
|
ContainerStatuses: []v1.ContainerStatus{
|
||||||
unprobed, probedReady, probedPending, probedUnready, terminated,
|
unprobed, probedReady, probedPending, probedUnready, notStartedNoReadiness, startedNoReadiness, terminated,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,10 +293,13 @@ func TestUpdatePodStatus(t *testing.T) {
|
|||||||
{testPodUID, probedReady.Name, readiness}: {},
|
{testPodUID, probedReady.Name, readiness}: {},
|
||||||
{testPodUID, probedPending.Name, readiness}: {},
|
{testPodUID, probedPending.Name, readiness}: {},
|
||||||
{testPodUID, probedUnready.Name, readiness}: {},
|
{testPodUID, probedUnready.Name, readiness}: {},
|
||||||
|
{testPodUID, notStartedNoReadiness.Name, startup}: {},
|
||||||
|
{testPodUID, startedNoReadiness.Name, startup}: {},
|
||||||
{testPodUID, terminated.Name, readiness}: {},
|
{testPodUID, terminated.Name, readiness}: {},
|
||||||
}
|
}
|
||||||
m.readinessManager.Set(kubecontainer.ParseContainerID(probedReady.ContainerID), results.Success, &v1.Pod{})
|
m.readinessManager.Set(kubecontainer.ParseContainerID(probedReady.ContainerID), results.Success, &v1.Pod{})
|
||||||
m.readinessManager.Set(kubecontainer.ParseContainerID(probedUnready.ContainerID), results.Failure, &v1.Pod{})
|
m.readinessManager.Set(kubecontainer.ParseContainerID(probedUnready.ContainerID), results.Failure, &v1.Pod{})
|
||||||
|
m.startupManager.Set(kubecontainer.ParseContainerID(startedNoReadiness.ContainerID), results.Success, &v1.Pod{})
|
||||||
m.readinessManager.Set(kubecontainer.ParseContainerID(terminated.ContainerID), results.Success, &v1.Pod{})
|
m.readinessManager.Set(kubecontainer.ParseContainerID(terminated.ContainerID), results.Success, &v1.Pod{})
|
||||||
|
|
||||||
m.UpdatePodStatus(testPodUID, &podStatus)
|
m.UpdatePodStatus(testPodUID, &podStatus)
|
||||||
@ -292,6 +309,8 @@ func TestUpdatePodStatus(t *testing.T) {
|
|||||||
{testPodUID, probedReady.Name, readiness}: true,
|
{testPodUID, probedReady.Name, readiness}: true,
|
||||||
{testPodUID, probedPending.Name, readiness}: false,
|
{testPodUID, probedPending.Name, readiness}: false,
|
||||||
{testPodUID, probedUnready.Name, readiness}: false,
|
{testPodUID, probedUnready.Name, readiness}: false,
|
||||||
|
{testPodUID, notStartedNoReadiness.Name, readiness}: false,
|
||||||
|
{testPodUID, startedNoReadiness.Name, readiness}: true,
|
||||||
{testPodUID, terminated.Name, readiness}: false,
|
{testPodUID, terminated.Name, readiness}: false,
|
||||||
}
|
}
|
||||||
for _, c := range podStatus.ContainerStatuses {
|
for _, c := range podStatus.ContainerStatuses {
|
||||||
|
Loading…
Reference in New Issue
Block a user