From b767dbdeb5bb227bf003f247f2af2c2fb0c4ce55 Mon Sep 17 00:00:00 2001 From: Masaki Kimura Date: Thu, 8 Nov 2018 21:03:50 +0000 Subject: [PATCH 1/6] 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) }) }) }) From 3c3f85295cdfe012ba8f994964f51fa485a76404 Mon Sep 17 00:00:00 2001 From: Masaki Kimura Date: Thu, 29 Nov 2018 20:21:16 +0000 Subject: [PATCH 2/6] Improve output of fsType check for failure case in volumes test --- test/e2e/framework/volume_util.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/framework/volume_util.go b/test/e2e/framework/volume_util.go index e4344471417..3687c22960f 100644 --- a/test/e2e/framework/volume_util.go +++ b/test/e2e/framework/volume_util.go @@ -479,7 +479,7 @@ func TestVolumeClient(client clientset.Interface, config VolumeTestConfig, fsGro 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) + _, err = LookForStringInPodExec(config.Namespace, clientPod.Name, []string{"grep", " /opt/0 ", "/proc/mounts"}, fsType, time.Minute) Expect(err).NotTo(HaveOccurred(), "failed: getting the right fsType %s", fsType) } } From 398bf3929f0d2ae121da2cd73da19d83c7e1ee0e Mon Sep 17 00:00:00 2001 From: Masaki Kimura Date: Thu, 29 Nov 2018 20:27:22 +0000 Subject: [PATCH 3/6] Skip XFS test for csi gce-pd driver on COS --- test/e2e/storage/drivers/csi.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/e2e/storage/drivers/csi.go b/test/e2e/storage/drivers/csi.go index dfcff4b9ba5..6b61acb1fa2 100644 --- a/test/e2e/storage/drivers/csi.go +++ b/test/e2e/storage/drivers/csi.go @@ -304,6 +304,9 @@ func (g *gcePDCSIDriver) SkipUnsupportedTest(pattern testpatterns.TestPattern) { // tests to fail. framework.SkipIfMultizone(f.ClientSet) } + if pattern.FsType == "xfs" { + framework.SkipUnlessNodeOSDistroIs("ubuntu", "custom") + } } func (g *gcePDCSIDriver) GetDynamicProvisionStorageClass(fsType string) *storagev1.StorageClass { @@ -407,6 +410,9 @@ func (g *gcePDExternalCSIDriver) GetDriverInfo() *testsuites.DriverInfo { func (g *gcePDExternalCSIDriver) SkipUnsupportedTest(pattern testpatterns.TestPattern) { framework.SkipUnlessProviderIs("gce", "gke") framework.SkipIfMultizone(g.driverInfo.Config.Framework.ClientSet) + if pattern.FsType == "xfs" { + framework.SkipUnlessNodeOSDistroIs("ubuntu", "custom") + } } func (g *gcePDExternalCSIDriver) GetDynamicProvisionStorageClass(fsType string) *storagev1.StorageClass { From 30ad1028ebf6beb0c6c0957222d87e228171f94b Mon Sep 17 00:00:00 2001 From: Masaki Kimura Date: Thu, 29 Nov 2018 23:11:31 +0000 Subject: [PATCH 4/6] Move xfs test skip logic from driver to testsuites --- test/e2e/storage/drivers/in_tree.go | 6 ------ test/e2e/storage/testsuites/base.go | 7 +++++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/test/e2e/storage/drivers/in_tree.go b/test/e2e/storage/drivers/in_tree.go index 728ab69794f..908516da6e5 100644 --- a/test/e2e/storage/drivers/in_tree.go +++ b/test/e2e/storage/drivers/in_tree.go @@ -259,9 +259,6 @@ func (g *glusterFSDriver) GetDriverInfo() *testsuites.DriverInfo { func (g *glusterFSDriver) SkipUnsupportedTest(pattern testpatterns.TestPattern) { framework.SkipUnlessNodeOSDistroIs("gci", "ubuntu", "custom") - if pattern.FsType == "xfs" { - framework.SkipUnlessNodeOSDistroIs("ubuntu", "custom") - } } func (g *glusterFSDriver) GetVolumeSource(readOnly bool, fsType string, testResource interface{}) *v1.VolumeSource { @@ -1178,9 +1175,6 @@ func (g *gcePdDriver) GetDriverInfo() *testsuites.DriverInfo { func (g *gcePdDriver) SkipUnsupportedTest(pattern testpatterns.TestPattern) { framework.SkipUnlessProviderIs("gce", "gke") - if pattern.FsType == "xfs" { - framework.SkipUnlessNodeOSDistroIs("ubuntu", "custom") - } } func (g *gcePdDriver) GetVolumeSource(readOnly bool, fsType string, testResource interface{}) *v1.VolumeSource { diff --git a/test/e2e/storage/testsuites/base.go b/test/e2e/storage/testsuites/base.go index 8638a90cfe1..c1fba8a2453 100644 --- a/test/e2e/storage/testsuites/base.go +++ b/test/e2e/storage/testsuites/base.go @@ -80,7 +80,7 @@ func RunTestSuite(f *framework.Framework, driver TestDriver, tsInits []func() Te // is not suitable to be tested. // Whether it needs to be skipped is checked by following steps: // 1. Check if Whether volType is supported by driver from its interface -// 2. Check if fsType is supported by driver +// 2. Check if fsType is supported // 3. Check with driver specific logic // 4. Check with testSuite specific logic func skipUnsupportedTest(suite TestSuite, driver TestDriver, pattern testpatterns.TestPattern) { @@ -103,10 +103,13 @@ func skipUnsupportedTest(suite TestSuite, driver TestDriver, pattern testpattern framework.Skipf("Driver %s doesn't support %v -- skipping", dInfo.Name, pattern.VolType) } - // 2. Check if fsType is supported by driver + // 2. Check if fsType is supported if !dInfo.SupportedFsType.Has(pattern.FsType) { framework.Skipf("Driver %s doesn't support %v -- skipping", dInfo.Name, pattern.FsType) } + if pattern.FsType == "xfs" && framework.NodeOSDistroIs("gci") { + framework.Skipf("Distro doesn't support xfs -- skipping") + } // 3. Check with driver specific logic driver.SkipUnsupportedTest(pattern) From 732eb69597f6b397b9be0253a1ff44759190483b Mon Sep 17 00:00:00 2001 From: Masaki Kimura Date: Sat, 1 Dec 2018 00:06:14 +0000 Subject: [PATCH 5/6] Fix AWS driver fails to provision specified fsType --- pkg/volume/awsebs/aws_util.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/volume/awsebs/aws_util.go b/pkg/volume/awsebs/aws_util.go index e1c85aa8b70..79eeea7bc0b 100644 --- a/pkg/volume/awsebs/aws_util.go +++ b/pkg/volume/awsebs/aws_util.go @@ -120,8 +120,10 @@ func (util *AWSDiskUtil) CreateVolume(c *awsElasticBlockStoreProvisioner, node * } fstype := "" - if v, ok := c.options.Parameters[volume.VolumeParameterFSType]; ok { - fstype = v + for k, v := range c.options.Parameters { + if strings.ToLower(k) == volume.VolumeParameterFSType { + fstype = v + } } return name, volumeOptions.CapacityGB, labels, fstype, nil From b152d435ae325a1b9b5e5aa7153b9dc098f5cb7e Mon Sep 17 00:00:00 2001 From: Masaki Kimura Date: Wed, 23 Jan 2019 05:26:55 +0000 Subject: [PATCH 6/6] Update fsType parameter for csi v1.0 provisioner --- test/e2e/storage/drivers/csi.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/e2e/storage/drivers/csi.go b/test/e2e/storage/drivers/csi.go index 6b61acb1fa2..6551854e643 100644 --- a/test/e2e/storage/drivers/csi.go +++ b/test/e2e/storage/drivers/csi.go @@ -316,7 +316,7 @@ func (g *gcePDCSIDriver) GetDynamicProvisionStorageClass(fsType string) *storage parameters := map[string]string{"type": "pd-standard"} if fsType != "" { - parameters["fsType"] = fsType + parameters["csi.storage.k8s.io/fstype"] = fsType } return testsuites.GetStorageClass(provisioner, parameters, nil, ns, suffix) @@ -422,7 +422,7 @@ func (g *gcePDExternalCSIDriver) GetDynamicProvisionStorageClass(fsType string) parameters := map[string]string{"type": "pd-standard"} if fsType != "" { - parameters["fsType"] = fsType + parameters["csi.storage.k8s.io/fstype"] = fsType } return testsuites.GetStorageClass(provisioner, parameters, nil, ns, suffix)