Skip to content

Commit

Permalink
test: move GetContainerDiskContainerOfPod func
Browse files Browse the repository at this point in the history
Move GetContainerDiskContainerOfPod from utils
to container_disk_test to make utils shorter.

Signed-off-by: Ben Oukhanov <[email protected]>
  • Loading branch information
codingben committed Jun 7, 2022
1 parent 64c05fa commit 2187081
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 6 additions & 1 deletion tests/container_disk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ var _ = Describe("[rfe_id:588][crit:medium][vendor:[email protected]][level:comp
vmi = tests.RunVMIAndExpectScheduling(vmi, 60)
Expect(vmi.Spec.Volumes[0].ContainerDisk.ImagePullPolicy).To(Equal(expectedPolicy))
pod := libvmi.GetPodByVirtualMachineInstance(vmi, vmi.Namespace)
container := tests.GetContainerDiskContainerOfPod(pod, vmi.Spec.Volumes[0].Name)
container := getContainerDiskContainerOfPod(pod, vmi.Spec.Volumes[0].Name)
Expect(container.ImagePullPolicy).To(Equal(expectedPolicy))
},
Entry("[test_id:3246]generate and set Always pull policy", "test", k8sv1.PullPolicy(""), k8sv1.PullAlways),
Expand Down Expand Up @@ -273,3 +273,8 @@ var _ = Describe("[rfe_id:588][crit:medium][vendor:[email protected]][level:comp
})
})
})

func getContainerDiskContainerOfPod(pod *k8sv1.Pod, volumeName string) *k8sv1.Container {
diskContainerName := fmt.Sprintf("volume%s", volumeName)
return tests.GetContainerOfPod(pod, diskContainerName)
}
5 changes: 0 additions & 5 deletions tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -969,11 +969,6 @@ func GetComputeContainerOfPod(pod *k8sv1.Pod) *k8sv1.Container {
return GetContainerOfPod(pod, "compute")
}

func GetContainerDiskContainerOfPod(pod *k8sv1.Pod, volumeName string) *k8sv1.Container {
diskContainerName := fmt.Sprintf("volume%s", volumeName)
return GetContainerOfPod(pod, diskContainerName)
}

func GetContainerOfPod(pod *k8sv1.Pod, containerName string) *k8sv1.Container {
var computeContainer *k8sv1.Container
for _, container := range pod.Spec.Containers {
Expand Down

0 comments on commit 2187081

Please sign in to comment.