From b767dbdeb5bb227bf003f247f2af2c2fb0c4ce55 Mon Sep 17 00:00:00 2001 From: Masaki Kimura Date: Thu, 8 Nov 2018 21:03:50 +0000 Subject: [PATCH] Fix volumes e2e test to check fsType --- test/e2e/common/volumes.go | 6 +++--- test/e2e/framework/volume_util.go | 8 +++++++- test/e2e/storage/drivers/csi.go | 6 ++++++ test/e2e/storage/flexvolume.go | 2 +- test/e2e/storage/testsuites/volumes.go | 4 +++- test/e2e/storage/volumes.go | 2 +- 6 files changed, 21 insertions(+), 7 deletions(-) diff --git a/test/e2e/common/volumes.go b/test/e2e/common/volumes.go index e6df9b5a0a7..0c4e63eca54 100644 --- a/test/e2e/common/volumes.go +++ b/test/e2e/common/volumes.go @@ -91,7 +91,7 @@ var _ = Describe("[sig-storage] GCP Volumes", func() { } // Must match content of test/images/volumes-tester/nfs/index.html - framework.TestVolumeClient(c, config, nil, tests) + framework.TestVolumeClient(c, config, nil, "" /* fsType */, tests) }) }) @@ -114,7 +114,7 @@ var _ = Describe("[sig-storage] GCP Volumes", func() { }, } // Must match content of test/images/volume-tester/nfs/index.html - framework.TestVolumeClient(c, config, nil, tests) + framework.TestVolumeClient(c, config, nil, "" /* fsType */, tests) }) }) @@ -147,7 +147,7 @@ var _ = Describe("[sig-storage] GCP Volumes", func() { ExpectedContent: "Hello from GlusterFS!", }, } - framework.TestVolumeClient(c, config, nil, tests) + framework.TestVolumeClient(c, config, nil, "" /* fsType */, tests) }) }) }) diff --git a/test/e2e/framework/volume_util.go b/test/e2e/framework/volume_util.go index 35625e9f13e..e4344471417 100644 --- a/test/e2e/framework/volume_util.go +++ b/test/e2e/framework/volume_util.go @@ -401,7 +401,7 @@ func VolumeTestCleanup(f *Framework, config VolumeTestConfig) { // and check that the pod sees expected data, e.g. from the server pod. // Multiple VolumeTests can be specified to mount multiple volumes to a single // pod. -func TestVolumeClient(client clientset.Interface, config VolumeTestConfig, fsGroup *int64, tests []VolumeTest) { +func TestVolumeClient(client clientset.Interface, config VolumeTestConfig, fsGroup *int64, fsType string, tests []VolumeTest) { By(fmt.Sprint("starting ", config.Prefix, " client")) var gracePeriod int64 = 1 clientPod := &v1.Pod{ @@ -476,6 +476,12 @@ func TestVolumeClient(client clientset.Interface, config VolumeTestConfig, fsGro _, err = LookForStringInPodExec(config.Namespace, clientPod.Name, []string{"ls", "-ld", "/opt/0"}, strconv.Itoa(int(*fsGroup)), time.Minute) Expect(err).NotTo(HaveOccurred(), "failed: getting the right privileges in the file %v", int(*fsGroup)) } + + if fsType != "" { + By("Checking fsType is correct.") + _, err = LookForStringInPodExec(config.Namespace, clientPod.Name, []string{"grep", fmt.Sprintf(" /opt/0 %s", fsType), "/proc/mounts"}, fsType, time.Minute) + Expect(err).NotTo(HaveOccurred(), "failed: getting the right fsType %s", fsType) + } } // Insert index.html with given content into given volume. It does so by diff --git a/test/e2e/storage/drivers/csi.go b/test/e2e/storage/drivers/csi.go index e5e3f7e3619..dfcff4b9ba5 100644 --- a/test/e2e/storage/drivers/csi.go +++ b/test/e2e/storage/drivers/csi.go @@ -312,6 +312,9 @@ func (g *gcePDCSIDriver) GetDynamicProvisionStorageClass(fsType string) *storage suffix := fmt.Sprintf("%s-sc", g.driverInfo.Name) parameters := map[string]string{"type": "pd-standard"} + if fsType != "" { + parameters["fsType"] = fsType + } return testsuites.GetStorageClass(provisioner, parameters, nil, ns, suffix) } @@ -412,6 +415,9 @@ func (g *gcePDExternalCSIDriver) GetDynamicProvisionStorageClass(fsType string) suffix := fmt.Sprintf("%s-sc", g.driverInfo.Name) parameters := map[string]string{"type": "pd-standard"} + if fsType != "" { + parameters["fsType"] = fsType + } return testsuites.GetStorageClass(provisioner, parameters, nil, ns, suffix) } diff --git a/test/e2e/storage/flexvolume.go b/test/e2e/storage/flexvolume.go index 6359a8a5e12..b49066808bf 100644 --- a/test/e2e/storage/flexvolume.go +++ b/test/e2e/storage/flexvolume.go @@ -63,7 +63,7 @@ func testFlexVolume(driver string, cs clientset.Interface, config framework.Volu ExpectedContent: "Hello from flexvolume!", }, } - framework.TestVolumeClient(cs, config, nil, tests) + framework.TestVolumeClient(cs, config, nil, "" /* fsType */, tests) framework.VolumeTestCleanup(f, config) } diff --git a/test/e2e/storage/testsuites/volumes.go b/test/e2e/storage/testsuites/volumes.go index 1d890e085a9..57222178eb0 100644 --- a/test/e2e/storage/testsuites/volumes.go +++ b/test/e2e/storage/testsuites/volumes.go @@ -111,6 +111,7 @@ func createVolumesTestInput(pattern testpatterns.TestPattern, resource genericVo config: &dInfo.Config, fsGroup: fsGroup, resource: resource, + fsType: pattern.FsType, tests: []framework.VolumeTest{ { Volume: *volSource, @@ -160,6 +161,7 @@ type volumesTestInput struct { name string config *TestConfig fsGroup *int64 + fsType string tests []framework.VolumeTest resource genericVolumeTestResource } @@ -175,7 +177,7 @@ func testVolumes(input *volumesTestInput) { volumeTest := input.tests config := convertTestConfig(input.config) framework.InjectHtml(cs, config, volumeTest[0].Volume, volumeTest[0].ExpectedContent) - framework.TestVolumeClient(cs, config, input.fsGroup, input.tests) + framework.TestVolumeClient(cs, config, input.fsGroup, input.fsType, input.tests) }) It("should allow exec of files on the volume", func() { f := input.f diff --git a/test/e2e/storage/volumes.go b/test/e2e/storage/volumes.go index 51f2ccb7ebb..7d7df6fde39 100644 --- a/test/e2e/storage/volumes.go +++ b/test/e2e/storage/volumes.go @@ -106,7 +106,7 @@ var _ = utils.SIGDescribe("Volumes", func() { ExpectedContent: "this is the second file", }, } - framework.TestVolumeClient(cs, config, nil, tests) + framework.TestVolumeClient(cs, config, nil, "" /* fsType */, tests) }) }) })