Skip to content

Commit

Permalink
static file volume test without specifying fstype
Browse files Browse the repository at this point in the history
  • Loading branch information
marunachalam committed Sep 19, 2020
1 parent 678fae4 commit cd63dc3
Showing 1 changed file with 32 additions and 6 deletions.
38 changes: 32 additions & 6 deletions tests/e2e/vsphere_file_volume_basic_mount.go
Expand Up @@ -74,7 +74,7 @@ var _ = ginkgo.Describe("[csi-file-vanilla] Verify Two Pods can read write files
1. Delete all the Pods, pvcs and storage class and verify the deletion
*/
ginkgo.It("[csi-file-vanilla] Verify Two Pods can read the files written by each other, when both have same pvc mounted", func() {
invokeTestForCreateFileVolumeAndMount(f, client, namespace, accessMode, filePath1, filePath2, false, false, false)
invokeTestForCreateFileVolumeAndMount(f, client, namespace, accessMode, filePath1, filePath2, false, false, false, true)
})

/*
Expand All @@ -97,7 +97,7 @@ var _ = ginkgo.Describe("[csi-file-vanilla] Verify Two Pods can read write files
1. Delete all the Pods, pvcs and storage class and verify the deletion
*/
ginkgo.It("[csi-file-vanilla] Verify Pod can read the files written by other Pod, which is deleted, when both have same pvc mounted", func() {
invokeTestForCreateFileVolumeAndMount(f, client, namespace, accessMode, filePath1, filePath2, true, false, false)
invokeTestForCreateFileVolumeAndMount(f, client, namespace, accessMode, filePath1, filePath2, true, false, false, true)
})

/*
Expand All @@ -119,7 +119,7 @@ var _ = ginkgo.Describe("[csi-file-vanilla] Verify Two Pods can read write files
1. Delete all the Pods, pvcs and storage class and verify the deletion
*/
ginkgo.It("[csi-file-vanilla] Verify Pod can read the files written by other Pod created as root user, when both have same pvc mounted", func() {
invokeTestForCreateFileVolumeAndMount(f, client, namespace, accessMode, filePath1, filePath2, false, true, false)
invokeTestForCreateFileVolumeAndMount(f, client, namespace, accessMode, filePath1, filePath2, false, true, false, true)
})

/*
Expand All @@ -142,7 +142,29 @@ var _ = ginkgo.Describe("[csi-file-vanilla] Verify Two Pods can read write files
1. Delete all the Pods, pvcs and storage class and verify the deletion
*/
ginkgo.It("[csi-file-vanilla] Verify Pod can read the files written by other Pod, which is deleted, when the Pod has pvc statically provisoned on same vsan file share", func() {
invokeTestForCreateFileVolumeAndMount(f, client, namespace, accessMode, filePath1, filePath2, true, false, true)
invokeTestForCreateFileVolumeAndMount(f, client, namespace, accessMode, filePath1, filePath2, true, false, true, true)
})
/*
Verify Pod can read the files written by other Pod, which is deleted, when both have same pvc mounted without specifing fstype in pv spec
1. Create StorageClass without specifying fsType
2. Create a PVC1 with "ReadWriteMany" using the SC from above
3. Wait for PVC1 to be Bound
4. Get the VolumeID from PV
5. Verify using CNS Query API if VolumeID retrieved from PV is present. Also verify
Name, Capacity, VolumeType, Health matches
6. Verify if VolumeID is created on one of the VSAN datastores from list of datacenters provided in vsphere.conf
7. Create Pod1 using PVC1 created above at a mount path specified in PodSpec
8. Create a file (file1.txt) at the mount path. Check if the creation is successful
9. Delete the Pod and create a PVC2 with same file share created with PVC1
10. Create Pod2 with PVC created above, Wait for Pod2 to be Running
11. Read the file (file1.txt) created in Step 8 from Pod2. Check if reading is successful
12. Create a new file (file2.txt) at the mount path from Pod2. Check if the creation is successful
Cleanup:
1. Delete all the Pods, pvcs and storage class and verify the deletion
*/
ginkgo.It("[csi-file-vanilla] Verify Pod can read the files written by other Pod, which is deleted, when the Pod has pvc statically provisoned on same vsan file share", func() {
invokeTestForCreateFileVolumeAndMount(f, client, namespace, accessMode, filePath1, filePath2, true, false, true, false)
})
})

Expand All @@ -154,11 +176,15 @@ Pod2 is created as normal user if secondPodForNonRootUser is true
Pod1 is deleted if isDeletePodAfterFileCreation is true
Pod2 is mounted on statically provisioned pvc backed by same file share id as Pvc1 if staticProvisionedPVCForSecondPod true
*/
func invokeTestForCreateFileVolumeAndMount(f *framework.Framework, client clientset.Interface, namespace string, accessMode v1.PersistentVolumeAccessMode, filePath1 string, filePath2 string, isDeletePodAfterFileCreation bool, secondPodForNonRootUser bool, staticProvisionedPVCForSecondPod bool) {
func invokeTestForCreateFileVolumeAndMount(f *framework.Framework, client clientset.Interface, namespace string, accessMode v1.PersistentVolumeAccessMode, filePath1 string, filePath2 string, isDeletePodAfterFileCreation bool, secondPodForNonRootUser bool, staticProvisionedPVCForSecondPod bool, fsType bool) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
scParameters := make(map[string]string)
scParameters[scParamFsType] = nfs4FSType
if fsType {
scParameters[scParamFsType] = nfs4FSType
} else {
scParameters = nil
}

// Create Storage class and PVC
ginkgo.By("Creating Storage Class and PVC With nfs4")
Expand Down

0 comments on commit cd63dc3

Please sign in to comment.