Skip to content

Commit

Permalink
Merge pull request kubevirt#8678 from maya-r/readiness-memorydump
Browse files Browse the repository at this point in the history
Use a readiness probe for memory dump test executor
  • Loading branch information
kubevirt-bot authored Nov 2, 2022
2 parents 03e0571 + 66157f8 commit 14e743a
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -1272,11 +1272,24 @@ func RenderPod(name string, cmd []string, args []string) *k8sv1.Pod {
// CreateExecutorPodWithPVC creates a Pod with the passed in PVC mounted under /pvc. You can then use the executor utilities to
// run commands against the PVC through this Pod.
func CreateExecutorPodWithPVC(podName string, pvc *k8sv1.PersistentVolumeClaim) *k8sv1.Pod {
return RunPod(newExecutorPodWithPVC(podName, pvc))
}
var err error

pod := libstorage.RenderPodWithPVC(podName, []string{"/bin/bash", "-c", "touch /tmp/startup; while true; do echo hello; sleep 2; done"}, nil, pvc)
pod.Spec.Containers[0].ReadinessProbe = &k8sv1.Probe{
ProbeHandler: k8sv1.ProbeHandler{
Exec: &k8sv1.ExecAction{
Command: []string{"/bin/cat", "/tmp/startup"},
},
},
}
pod = RunPod(pod)

func newExecutorPodWithPVC(podName string, pvc *k8sv1.PersistentVolumeClaim) *k8sv1.Pod {
return libstorage.RenderPodWithPVC(podName, []string{"/bin/bash", "-c", "while true; do echo hello; sleep 2;done"}, nil, pvc)
Eventually(func() bool {
pod, err = ThisPod(pod)()
Expect(err).ToNot(HaveOccurred())
return PodReady(pod) == k8sv1.ConditionTrue
}, 120).Should(BeTrue())
return pod
}

func RunPodInNamespace(pod *k8sv1.Pod, namespace string) *k8sv1.Pod {
Expand Down

0 comments on commit 14e743a

Please sign in to comment.