Skip to content

Commit 12b1252

Browse files
committed
e2e: case for multiple volumes reference one PVC
1 parent dc4589f commit 12b1252

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/e2e/storage/persistent_volumes.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,25 @@ var _ = utils.SIGDescribe("PersistentVolumes", func() {
211211
completeTest(ctx, f, c, ns, pv, pvc)
212212
})
213213

214+
// The same as above, but with multiple volumes reference the same PVC in the pod.
215+
ginkgo.It("create a PVC and use it multiple times in a single pod", func(ctx context.Context) {
216+
pv, pvc, err = e2epv.CreatePVPVC(ctx, c, f.Timeouts, pvConfig, pvcConfig, ns, true)
217+
framework.ExpectNoError(err)
218+
219+
framework.Logf("Creating nfs test pod")
220+
pod := e2epod.MakePod(ns, nil, []*v1.PersistentVolumeClaim{pvc, pvc}, admissionapi.LevelPrivileged,
221+
"touch /mnt/volume1/SUCCESS && cat /mnt/volume2/SUCCESS")
222+
runPod, err := c.CoreV1().Pods(ns).Create(ctx, pod, metav1.CreateOptions{})
223+
framework.ExpectNoError(err)
224+
defer func() {
225+
err := e2epod.DeletePodWithWait(ctx, c, runPod)
226+
framework.ExpectNoError(err)
227+
}()
228+
229+
err = testPodSuccessOrFail(ctx, c, f.Timeouts, ns, runPod)
230+
framework.ExpectNoError(err)
231+
})
232+
214233
// Create new PV without claim, verify it's in Available state and LastPhaseTransitionTime is set.
215234
f.It("create a PV: test phase transition timestamp is set and phase is Available", func(ctx context.Context) {
216235
pvObj := e2epv.MakePersistentVolume(pvConfig)

0 commit comments

Comments
 (0)