From 94bf2b0ccf166da407effe6c759eb7553cd32454 Mon Sep 17 00:00:00 2001 From: Casey Davenport Date: Wed, 13 Sep 2017 15:50:56 -0700 Subject: [PATCH] Attempt at fixing UTs --- .../kuberuntime/kuberuntime_manager_test.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pkg/kubelet/kuberuntime/kuberuntime_manager_test.go b/pkg/kubelet/kuberuntime/kuberuntime_manager_test.go index b8157b8c940..85a06794eeb 100644 --- a/pkg/kubelet/kuberuntime/kuberuntime_manager_test.go +++ b/pkg/kubelet/kuberuntime/kuberuntime_manager_test.go @@ -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