From d35eb5632251a6969a4dcb9f271f7f0755c6be94 Mon Sep 17 00:00:00 2001 From: Jing Xu Date: Tue, 25 Aug 2020 23:31:47 -0700 Subject: [PATCH] Fix issue on skipTest in storage suits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After PR https://github.com/kubernetes/kubernetes/pull/92555, there are a number of gce pd default fs tests skipped. Here the testpatten has SnapshotType set because some provisioning tests use snapshots. But for drivers such as In-tree gce pd driver, the tests will be skipped because of the logic in skipUnsupportedTesthttps://github.com/kubernetes/kubernetes/blob/master/test/e2e/storage/testsuites/base.go#L154 Since multiple drivers might test with the same pattern, so I think we need keep SnapshotType here. This PR removes the part of the logic in skipUnsupportedTest. This should be ok because all snapshot tests will check whether a driver has snapshot capability or not. --- test/e2e/storage/testsuites/base.go | 70 ++++++++++++----------------- 1 file changed, 28 insertions(+), 42 deletions(-) diff --git a/test/e2e/storage/testsuites/base.go b/test/e2e/storage/testsuites/base.go index aafbb630f2b..7519d0a0806 100644 --- a/test/e2e/storage/testsuites/base.go +++ b/test/e2e/storage/testsuites/base.go @@ -149,50 +149,36 @@ func skipUnsupportedTest(driver TestDriver, pattern testpatterns.TestPattern) { dInfo := driver.GetDriverInfo() var isSupported bool - // 1. Check if Whether SnapshotType is supported by driver from its interface - // if isSupported, we still execute the driver and suite tests - if len(pattern.SnapshotType) > 0 { - switch pattern.SnapshotType { - case testpatterns.DynamicCreatedSnapshot: - _, isSupported = driver.(SnapshottableTestDriver) - default: - isSupported = false - } - if !isSupported { - e2eskipper.Skipf("Driver %s doesn't support snapshot type %v -- skipping", dInfo.Name, pattern.SnapshotType) - } - } else { - // 2. Check if Whether volType is supported by driver from its interface - switch pattern.VolType { - case testpatterns.InlineVolume: - _, isSupported = driver.(InlineVolumeTestDriver) - case testpatterns.PreprovisionedPV: - _, isSupported = driver.(PreprovisionedPVTestDriver) - case testpatterns.DynamicPV, testpatterns.GenericEphemeralVolume: - _, isSupported = driver.(DynamicPVTestDriver) - case testpatterns.CSIInlineVolume: - _, isSupported = driver.(EphemeralTestDriver) - default: - isSupported = false - } - - if !isSupported { - e2eskipper.Skipf("Driver %s doesn't support %v -- skipping", dInfo.Name, pattern.VolType) - } - - // 3. Check if fsType is supported - if !dInfo.SupportedFsType.Has(pattern.FsType) { - e2eskipper.Skipf("Driver %s doesn't support %v -- skipping", dInfo.Name, pattern.FsType) - } - if pattern.FsType == "xfs" && framework.NodeOSDistroIs("gci", "cos", "windows") { - e2eskipper.Skipf("Distro doesn't support xfs -- skipping") - } - if pattern.FsType == "ntfs" && !framework.NodeOSDistroIs("windows") { - e2eskipper.Skipf("Distro %s doesn't support ntfs -- skipping", framework.TestContext.NodeOSDistro) - } + // 1. Check if Whether volType is supported by driver from its interface + switch pattern.VolType { + case testpatterns.InlineVolume: + _, isSupported = driver.(InlineVolumeTestDriver) + case testpatterns.PreprovisionedPV: + _, isSupported = driver.(PreprovisionedPVTestDriver) + case testpatterns.DynamicPV, testpatterns.GenericEphemeralVolume: + _, isSupported = driver.(DynamicPVTestDriver) + case testpatterns.CSIInlineVolume: + _, isSupported = driver.(EphemeralTestDriver) + default: + isSupported = false } - // 4. Check with driver specific logic + if !isSupported { + e2eskipper.Skipf("Driver %s doesn't support %v -- skipping", dInfo.Name, pattern.VolType) + } + + // 2. Check if fsType is supported + if !dInfo.SupportedFsType.Has(pattern.FsType) { + e2eskipper.Skipf("Driver %s doesn't support %v -- skipping", dInfo.Name, pattern.FsType) + } + if pattern.FsType == "xfs" && framework.NodeOSDistroIs("gci", "cos", "windows") { + e2eskipper.Skipf("Distro doesn't support xfs -- skipping") + } + if pattern.FsType == "ntfs" && !framework.NodeOSDistroIs("windows") { + e2eskipper.Skipf("Distro %s doesn't support ntfs -- skipping", framework.TestContext.NodeOSDistro) + } + + // 3. Check with driver specific logic driver.SkipUnsupportedTest(pattern) }