Skip to content

Commit 58ba199

Browse files
authored
tests: stop using /dev/pvc hack (#4012)
we used to have issues with mounting it on /pvc but that is probably all gone now: 24989ea Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
1 parent c309762 commit 58ba199

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

tests/framework/pvc.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func (f *Framework) FindPVC(pvcName string) (*k8sv1.PersistentVolumeClaim, error
7676
return utils.FindPVC(f.K8sClient, f.Namespace.Name, pvcName)
7777
}
7878

79-
// ForceBindPvcIfDvIsWaitForFirstConsumer creates a Pod with the PVC for passed in DV mounted under /dev/pvc, which forces the PVC to be scheduled and bound.
79+
// ForceBindPvcIfDvIsWaitForFirstConsumer creates a Pod with the PVC for passed in DV mounted under /pvc, which forces the PVC to be scheduled and bound.
8080
func (f *Framework) ForceBindPvcIfDvIsWaitForFirstConsumer(dv *cdiv1.DataVolume) {
8181
fmt.Fprintf(ginkgo.GinkgoWriter, "verifying pvc was created for dv %s\n", dv.Name)
8282
// FIXME: #1210, brybacki, tomob this code assumes dvname = pvcname needs to be fixed,
@@ -101,7 +101,7 @@ func (f *Framework) WaitPVCDeletedByUID(pvcSpec *k8sv1.PersistentVolumeClaim, ti
101101
return utils.WaitPVCDeletedByUID(f.K8sClient, pvcSpec, timeout)
102102
}
103103

104-
// ForceBindIfWaitForFirstConsumer creates a Pod with the passed in PVC mounted under /dev/pvc, which forces the PVC to be scheduled and bound.
104+
// ForceBindIfWaitForFirstConsumer creates a Pod with the passed in PVC mounted under /pvc, which forces the PVC to be scheduled and bound.
105105
func (f *Framework) ForceBindIfWaitForFirstConsumer(targetPvc *k8sv1.PersistentVolumeClaim) {
106106
if targetPvc.Spec.VolumeName == "" && f.IsBindingModeWaitForFirstConsumer(targetPvc.Spec.StorageClassName) {
107107
if targetPvc.Spec.DataSourceRef != nil {
@@ -112,7 +112,7 @@ func (f *Framework) ForceBindIfWaitForFirstConsumer(targetPvc *k8sv1.PersistentV
112112
}
113113
}
114114

115-
// ForceSchedulingIfWaitForFirstConsumerPopulationPVC creates a Pod with the passed in PVC mounted under /dev/pvc, which forces the PVC to be scheduled for provisioning.
115+
// ForceSchedulingIfWaitForFirstConsumerPopulationPVC creates a Pod with the passed in PVC mounted under /pvc, which forces the PVC to be scheduled for provisioning.
116116
func (f *Framework) ForceSchedulingIfWaitForFirstConsumerPopulationPVC(targetPvc *k8sv1.PersistentVolumeClaim) {
117117
if f.IsBindingModeWaitForFirstConsumer(targetPvc.Spec.StorageClassName) {
118118
createConsumerPodForPopulationPVC(targetPvc, f)
@@ -172,15 +172,15 @@ func VerifyPVCIsEmpty(f *Framework, pvc *k8sv1.PersistentVolumeClaim, node strin
172172
gomega.Expect(err).ToNot(gomega.HaveOccurred())
173173
err = f.WaitTimeoutForPodReady(executorPod.Name, utils.PodWaitForTime)
174174
gomega.Expect(err).ToNot(gomega.HaveOccurred())
175-
output, stderr, err := f.ExecShellInPod(executorPod.Name, f.Namespace.Name, "ls -1 /dev/pvc | wc -l")
175+
output, stderr, err := f.ExecShellInPod(executorPod.Name, f.Namespace.Name, fmt.Sprintf("ls -1 %s | wc -l", utils.DefaultPvcMountPath))
176176
if err != nil {
177177
fmt.Fprintf(ginkgo.GinkgoWriter, "INFO: stderr: [%s]\n", stderr)
178178
return false, err
179179
}
180180
found := strings.Compare("0", output) == 0
181181
if !found {
182182
// Could be that a file system was created and it has 'lost+found' directory in it, check again.
183-
output, stderr, err := f.ExecShellInPod(executorPod.Name, f.Namespace.Name, "ls -1 /dev/pvc")
183+
output, stderr, err := f.ExecShellInPod(executorPod.Name, f.Namespace.Name, fmt.Sprintf("ls -1 %s", utils.DefaultPvcMountPath))
184184
if err != nil {
185185
fmt.Fprintf(ginkgo.GinkgoWriter, "INFO: stderr: [%s]\n", stderr)
186186
return false, err
@@ -480,13 +480,13 @@ func (f *Framework) GetEnvVarValue(name string) (importerImage string) {
480480
return ""
481481
}
482482

483-
// CreateExecutorPodWithPVC creates a Pod with the passed in PVC mounted under /dev/pvc. You can then use the executor utilities to
483+
// CreateExecutorPodWithPVC creates a Pod with the passed in PVC mounted under /pvc. You can then use the executor utilities to
484484
// run commands against the PVC through this Pod.
485485
func (f *Framework) CreateExecutorPodWithPVC(podName, namespace string, pvc *k8sv1.PersistentVolumeClaim, readOnly bool) (*k8sv1.Pod, error) {
486486
return utils.CreatePod(f.K8sClient, namespace, f.newExecutorPodWithPVC(podName, pvc, readOnly))
487487
}
488488

489-
// CreateExecutorPodWithPVCSpecificNode creates a Pod on a specific node with the passed in PVC mounted under /dev/pvc. You can then use the executor utilities to
489+
// CreateExecutorPodWithPVCSpecificNode creates a Pod on a specific node with the passed in PVC mounted under /pvc. You can then use the executor utilities to
490490
// run commands against the PVC through this Pod.
491491
func (f *Framework) CreateExecutorPodWithPVCSpecificNode(podName, namespace string, pvc *k8sv1.PersistentVolumeClaim, node string, readOnly bool) (*k8sv1.Pod, error) {
492492
var pod = f.newExecutorPodWithPVC(podName, pvc, readOnly)
@@ -501,7 +501,7 @@ func (f *Framework) CreateNoopPodWithPVC(podName, namespace string, pvc *k8sv1.P
501501
return utils.CreatePod(f.K8sClient, namespace, f.NewPodWithPVC(podName, "echo I am vm doppleganger pod;", pvc, true))
502502
}
503503

504-
// CreateVerifierPodWithPVC creates a Pod called verifier, with the passed in PVC mounted under /dev/pvc. You can then use the executor utilities to
504+
// CreateVerifierPodWithPVC creates a Pod called verifier, with the passed in PVC mounted under /pvc. You can then use the executor utilities to
505505
// run commands against the PVC through this Pod.
506506
func (f *Framework) CreateVerifierPodWithPVC(namespace string, pvc *k8sv1.PersistentVolumeClaim) (*k8sv1.Pod, error) {
507507
return f.CreateExecutorPodWithPVC(utils.VerifierPodName, namespace, pvc, true)

tests/utils/pvc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const (
2727
defaultPollPeriodFast = 30 * time.Second
2828

2929
// DefaultPvcMountPath is the default mount path used
30-
DefaultPvcMountPath = "/dev/pvc"
30+
DefaultPvcMountPath = "/pvc"
3131

3232
// DefaultImagePath is the default destination for images created by CDI
3333
DefaultImagePath = DefaultPvcMountPath + "/disk.img"

0 commit comments

Comments
 (0)