diff --git a/hack/.golint_failures b/hack/.golint_failures index 985fda9cd78..064c109f162 100644 --- a/hack/.golint_failures +++ b/hack/.golint_failures @@ -609,7 +609,6 @@ test/e2e/lifecycle/bootstrap test/e2e/node test/e2e/scalability test/e2e/scheduling -test/e2e/storage test/e2e/storage/drivers test/e2e/storage/testsuites test/e2e/storage/utils diff --git a/test/e2e/storage/csi_mock_volume.go b/test/e2e/storage/csi_mock_volume.go index 0ef00d2287d..0c0fea51a3e 100644 --- a/test/e2e/storage/csi_mock_volume.go +++ b/test/e2e/storage/csi_mock_volume.go @@ -756,12 +756,11 @@ func checkPodInfo(cs clientset.Interface, namespace, driverPodName, driverContai return fmt.Errorf("number of found volume attributes does not match, expected %d, got %d", len(expectedAttributes), foundAttributes.Len()) } return nil - } else { - if foundAttributes.Len() != 0 { - return fmt.Errorf("some unexpected volume attributes were found: %+v", foundAttributes.List()) - } - return nil } + if foundAttributes.Len() != 0 { + return fmt.Errorf("some unexpected volume attributes were found: %+v", foundAttributes.List()) + } + return nil } func waitForCSIDriver(cs clientset.Interface, driverName string) error { @@ -774,7 +773,7 @@ func waitForCSIDriver(cs clientset.Interface, driverName string) error { return err } } - return fmt.Errorf("gave up after waiting %v for CSIDriver %q.", timeout, driverName) + return fmt.Errorf("gave up after waiting %v for CSIDriver %q", timeout, driverName) } func destroyCSIDriver(cs clientset.Interface, driverName string) { diff --git a/test/e2e/storage/detach_mounted.go b/test/e2e/storage/detach_mounted.go index 8a64d3e93a2..25d72fc62fe 100644 --- a/test/e2e/storage/detach_mounted.go +++ b/test/e2e/storage/detach_mounted.go @@ -35,6 +35,7 @@ import ( ) var ( + // BusyBoxImage is the image URI of BusyBox. BusyBoxImage = imageutils.GetE2EImage(imageutils.BusyBox) durationForStuckMount = 110 * time.Second ) diff --git a/test/e2e/storage/nfs_persistent_volume-disruptive.go b/test/e2e/storage/nfs_persistent_volume-disruptive.go index 9fa50814c1d..1973436540f 100644 --- a/test/e2e/storage/nfs_persistent_volume-disruptive.go +++ b/test/e2e/storage/nfs_persistent_volume-disruptive.go @@ -39,10 +39,6 @@ type disruptiveTest struct { runTest testBody } -const ( - MinNodes = 2 -) - var _ = utils.SIGDescribe("NFSPersistentVolumes[Disruptive][Flaky]", func() { f := framework.NewDefaultFramework("disruptive-pv") @@ -60,7 +56,7 @@ var _ = utils.SIGDescribe("NFSPersistentVolumes[Disruptive][Flaky]", func() { ginkgo.BeforeEach(func() { // To protect the NFS volume pod from the kubelet restart, we isolate it on its own node. - framework.SkipUnlessNodeCountIsAtLeast(MinNodes) + framework.SkipUnlessNodeCountIsAtLeast(minNodes) framework.SkipIfProviderIs("local") c = f.ClientSet diff --git a/test/e2e/storage/pd.go b/test/e2e/storage/pd.go index c4f4614983e..e0c31653fa4 100644 --- a/test/e2e/storage/pd.go +++ b/test/e2e/storage/pd.go @@ -421,9 +421,8 @@ var _ = utils.SIGDescribe("Pod Disks", func() { err = cs.CoreV1().Pods(ns).Evict(evictTarget) if err != nil { return false, nil - } else { - return true, nil } + return true, nil }) framework.ExpectNoError(err, fmt.Sprintf("failed to evict host0Pod after %v", podEvictTimeout)) } diff --git a/test/e2e/storage/persistent_volumes-local.go b/test/e2e/storage/persistent_volumes-local.go index ec59ea81d51..4094beaced9 100644 --- a/test/e2e/storage/persistent_volumes-local.go +++ b/test/e2e/storage/persistent_volumes-local.go @@ -59,27 +59,30 @@ type localTestConfig struct { type localVolumeType string const ( - // default local volume type, aka a directory + // DirectoryLocalVolumeType is the default local volume type, aka a directory DirectoryLocalVolumeType localVolumeType = "dir" - // like DirectoryLocalVolumeType but it's a symbolic link to directory + // DirectoryLinkLocalVolumeType is like DirectoryLocalVolumeType, + // but it's a symbolic link to directory DirectoryLinkLocalVolumeType localVolumeType = "dir-link" - // like DirectoryLocalVolumeType but bind mounted + // DirectoryBindMountedLocalVolumeType is like DirectoryLocalVolumeType + // but bind mounted DirectoryBindMountedLocalVolumeType localVolumeType = "dir-bindmounted" - // like DirectoryLocalVolumeType but it's a symbolic link to self bind mounted directory + // DirectoryLinkBindMountedLocalVolumeType is like DirectoryLocalVolumeType, + // but it's a symbolic link to self bind mounted directory // Note that bind mounting at symbolic link actually mounts at directory it // links to. DirectoryLinkBindMountedLocalVolumeType localVolumeType = "dir-link-bindmounted" - // creates a tmpfs and mounts it + // TmpfsLocalVolumeType creates a tmpfs and mounts it TmpfsLocalVolumeType localVolumeType = "tmpfs" - // tests based on local ssd at /mnt/disks/by-uuid/ + // GCELocalSSDVolumeType tests based on local ssd at /mnt/disks/by-uuid/ GCELocalSSDVolumeType localVolumeType = "gce-localssd-scsi-fs" - // Creates a local file, formats it, and maps it as a block device. + // BlockLocalVolumeType creates a local file, formats it, and maps it as a block device. BlockLocalVolumeType localVolumeType = "block" - // Creates a local file serving as the backing for block device., formats it, - // and mounts it to use as FS mode local volume. + // BlockFsWithFormatLocalVolumeType creates a local file serving as the backing for block device, + // formats it, and mounts it to use as FS mode local volume. BlockFsWithFormatLocalVolumeType localVolumeType = "blockfswithformat" - // Creates a local file serving as the backing for block device. do not format it manually, - // and mounts it to use as FS mode local volume. + // BlockFsWithoutFormatLocalVolumeType creates a local file serving as the backing for block device, + // does not format it manually, and mounts it to use as FS mode local volume. BlockFsWithoutFormatLocalVolumeType localVolumeType = "blockfswithoutformat" ) @@ -1003,21 +1006,19 @@ func createWriteCmd(testDir string, testFile string, writeTestFileContent string // Cleanup the file containing testFileContent. deleteTestFileCmd := fmt.Sprintf("rm %s", testFilePath) return fmt.Sprintf("%s && %s && %s && %s", writeTestFileCmd, sudoCmd, writeBlockCmd, deleteTestFileCmd) - } else { - testFilePath := filepath.Join(testDir, testFile) - return fmt.Sprintf("mkdir -p %s; echo %s > %s", testDir, writeTestFileContent, testFilePath) } + testFilePath := filepath.Join(testDir, testFile) + return fmt.Sprintf("mkdir -p %s; echo %s > %s", testDir, writeTestFileContent, testFilePath) } func createReadCmd(testFileDir string, testFile string, volumeType localVolumeType) string { if volumeType == BlockLocalVolumeType { // Create the command to read the beginning of the block device and print it in ascii. return fmt.Sprintf("hexdump -n 100 -e '100 \"%%_p\"' %s | head -1", testFileDir) - } else { - // Create the command to read (aka cat) a file. - testFilePath := filepath.Join(testFileDir, testFile) - return fmt.Sprintf("cat %s", testFilePath) } + // Create the command to read (aka cat) a file. + testFilePath := filepath.Join(testFileDir, testFile) + return fmt.Sprintf("cat %s", testFilePath) } // Read testFile and evaluate whether it contains the testFileContent diff --git a/test/e2e/storage/volume_provisioning.go b/test/e2e/storage/volume_provisioning.go index 7838662f241..4b179617cfd 100644 --- a/test/e2e/storage/volume_provisioning.go +++ b/test/e2e/storage/volume_provisioning.go @@ -847,7 +847,7 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() { framework.SkipIfProviderIs("gke") ginkgo.By("creating a Gluster DP server Pod") pod := startGlusterDpServerPod(c, ns) - serverUrl := "http://" + pod.Status.PodIP + ":8081" + serverURL := "http://" + pod.Status.PodIP + ":8081" ginkgo.By("creating a StorageClass") test := testsuites.StorageClassTest{ Client: c, @@ -855,7 +855,7 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() { Provisioner: "kubernetes.io/glusterfs", ClaimSize: "2Gi", ExpectedSize: "2Gi", - Parameters: map[string]string{"resturl": serverUrl}, + Parameters: map[string]string{"resturl": serverURL}, } suffix := fmt.Sprintf("glusterdptest") test.Class = newStorageClass(test, ns, suffix) @@ -1206,9 +1206,8 @@ func waitForProvisionedVolumesDeleted(c clientset.Interface, scName string) ([]* } if len(remainingPVs) > 0 { return false, nil // Poll until no PVs remain - } else { - return true, nil // No PVs remain } + return true, nil // No PVs remain }) return remainingPVs, err } diff --git a/test/e2e/storage/volumes.go b/test/e2e/storage/volumes.go index 49224c31e3f..d2edf0158f8 100644 --- a/test/e2e/storage/volumes.go +++ b/test/e2e/storage/volumes.go @@ -15,6 +15,7 @@ limitations under the License. */ // This test is volumes test for configmap. + package storage import (