mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 06:54:01 +00:00
Attempt at fixing UTs
This commit is contained in:
parent
be5cd7fed2
commit
94bf2b0ccf
@ -750,6 +750,7 @@ func makeBasePodAndStatus() (*v1.Pod, *kubecontainer.PodStatus) {
|
||||
Id: "sandboxID",
|
||||
State: runtimeapi.PodSandboxState_SANDBOX_READY,
|
||||
Metadata: &runtimeapi.PodSandboxMetadata{Name: pod.Name, Namespace: pod.Namespace, Uid: "sandboxuid", Attempt: uint32(0)},
|
||||
Network: &runtimeapi.PodSandboxNetworkStatus{Ip: "10.0.0.1"},
|
||||
},
|
||||
},
|
||||
ContainerStatuses: []*kubecontainer.ContainerStatus{
|
||||
@ -883,7 +884,19 @@ func TestComputePodActions(t *testing.T) {
|
||||
ContainersToKill: getKillMap(basePod, baseStatus, []int{}),
|
||||
},
|
||||
},
|
||||
|
||||
"Kill pod and recreate all containers if the PodSandbox does not have an IP": {
|
||||
mutateStatusFn: func(status *kubecontainer.PodStatus) {
|
||||
status.SandboxStatuses[0].Network.Ip = ""
|
||||
},
|
||||
actions: podActions{
|
||||
KillPod: true,
|
||||
CreateSandbox: true,
|
||||
SandboxID: baseStatus.SandboxStatuses[0].Id,
|
||||
Attempt: uint32(1),
|
||||
ContainersToStart: []int{0, 1, 2},
|
||||
ContainersToKill: getKillMap(basePod, baseStatus, []int{}),
|
||||
},
|
||||
},
|
||||
"Kill and recreate the container if the container's spec changed": {
|
||||
mutatePodFn: func(pod *v1.Pod) {
|
||||
pod.Spec.RestartPolicy = v1.RestartPolicyAlways
|
||||
|
Loading…
Reference in New Issue
Block a user