containerized-data-importer/tests/framework/pod.go
Michael Henriksen 795d353d2f
fix weirdly broken test (verifying fsgroup on block device) (#1195)
Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2020-05-04 21:03:18 +02:00

45 lines
1.6 KiB
Go

package framework
import (
"time"
k8sv1 "k8s.io/api/core/v1"
"kubevirt.io/containerized-data-importer/pkg/common"
"kubevirt.io/containerized-data-importer/tests/utils"
)
// CreatePod is a wrapper around utils.CreatePod
func (f *Framework) CreatePod(podDef *k8sv1.Pod) (*k8sv1.Pod, error) {
return utils.CreatePod(f.K8sClient, f.Namespace.Name, podDef)
}
// DeletePod is a wrapper around utils.DeletePod
func (f *Framework) DeletePod(pod *k8sv1.Pod) error {
ns := f.Namespace.Name
if pod.Namespace != "" {
ns = pod.Namespace
}
return utils.DeletePod(f.K8sClient, pod, ns)
}
// WaitTimeoutForPodReady is a wrapper around utils.WaitTimeouotForPodReady
func (f *Framework) WaitTimeoutForPodReady(podName string, timeout time.Duration) error {
return utils.WaitTimeoutForPodReady(f.K8sClient, podName, f.Namespace.Name, timeout)
}
// WaitTimeoutForPodStatus is a wrapper around utils.WaitTimeouotForPodStatus
func (f *Framework) WaitTimeoutForPodStatus(podName string, status k8sv1.PodPhase, timeout time.Duration) error {
return utils.WaitTimeoutForPodStatus(f.K8sClient, podName, f.Namespace.Name, status, timeout)
}
// FindPodByPrefix is a wrapper around utils.FindPodByPrefix
func (f *Framework) FindPodByPrefix(prefix string) (*k8sv1.Pod, error) {
return utils.FindPodByPrefix(f.K8sClient, f.Namespace.Name, prefix, common.CDILabelSelector)
}
// FindPodBySuffix is a wrapper around utils.FindPodByPostFix
func (f *Framework) FindPodBySuffix(prefix string) (*k8sv1.Pod, error) {
return utils.FindPodBysuffix(f.K8sClient, f.Namespace.Name, prefix, common.CDILabelSelector)
}