Skip to content

Commit 01d38fe

Browse files
committed
fix golint failures of test/e2e/storage
1 parent b03367b commit 01d38fe

File tree

8 files changed

+31
-36
lines changed

8 files changed

+31
-36
lines changed

hack/.golint_failures

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,6 @@ test/e2e/network
610610
test/e2e/node
611611
test/e2e/scalability
612612
test/e2e/scheduling
613-
test/e2e/storage
614613
test/e2e/storage/drivers
615614
test/e2e/storage/testsuites
616615
test/e2e/storage/utils

test/e2e/storage/csi_mock_volume.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -756,12 +756,11 @@ func checkPodInfo(cs clientset.Interface, namespace, driverPodName, driverContai
756756
return fmt.Errorf("number of found volume attributes does not match, expected %d, got %d", len(expectedAttributes), foundAttributes.Len())
757757
}
758758
return nil
759-
} else {
760-
if foundAttributes.Len() != 0 {
761-
return fmt.Errorf("some unexpected volume attributes were found: %+v", foundAttributes.List())
762-
}
763-
return nil
764759
}
760+
if foundAttributes.Len() != 0 {
761+
return fmt.Errorf("some unexpected volume attributes were found: %+v", foundAttributes.List())
762+
}
763+
return nil
765764
}
766765

767766
func waitForCSIDriver(cs clientset.Interface, driverName string) error {
@@ -774,7 +773,7 @@ func waitForCSIDriver(cs clientset.Interface, driverName string) error {
774773
return err
775774
}
776775
}
777-
return fmt.Errorf("gave up after waiting %v for CSIDriver %q.", timeout, driverName)
776+
return fmt.Errorf("gave up after waiting %v for CSIDriver %q", timeout, driverName)
778777
}
779778

780779
func destroyCSIDriver(cs clientset.Interface, driverName string) {

test/e2e/storage/detach_mounted.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import (
3535
)
3636

3737
var (
38+
// BusyBoxImage is the image URI of BusyBox.
3839
BusyBoxImage = imageutils.GetE2EImage(imageutils.BusyBox)
3940
durationForStuckMount = 110 * time.Second
4041
)

test/e2e/storage/nfs_persistent_volume-disruptive.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ type disruptiveTest struct {
3939
runTest testBody
4040
}
4141

42-
const (
43-
MinNodes = 2
44-
)
45-
4642
var _ = utils.SIGDescribe("NFSPersistentVolumes[Disruptive][Flaky]", func() {
4743

4844
f := framework.NewDefaultFramework("disruptive-pv")
@@ -60,7 +56,7 @@ var _ = utils.SIGDescribe("NFSPersistentVolumes[Disruptive][Flaky]", func() {
6056

6157
ginkgo.BeforeEach(func() {
6258
// To protect the NFS volume pod from the kubelet restart, we isolate it on its own node.
63-
framework.SkipUnlessNodeCountIsAtLeast(MinNodes)
59+
framework.SkipUnlessNodeCountIsAtLeast(minNodes)
6460
framework.SkipIfProviderIs("local")
6561

6662
c = f.ClientSet

test/e2e/storage/pd.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,9 +421,8 @@ var _ = utils.SIGDescribe("Pod Disks", func() {
421421
err = cs.CoreV1().Pods(ns).Evict(evictTarget)
422422
if err != nil {
423423
return false, nil
424-
} else {
425-
return true, nil
426424
}
425+
return true, nil
427426
})
428427
framework.ExpectNoError(err, fmt.Sprintf("failed to evict host0Pod after %v", podEvictTimeout))
429428
}

test/e2e/storage/persistent_volumes-local.go

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,27 +59,30 @@ type localTestConfig struct {
5959
type localVolumeType string
6060

6161
const (
62-
// default local volume type, aka a directory
62+
// DirectoryLocalVolumeType is the default local volume type, aka a directory
6363
DirectoryLocalVolumeType localVolumeType = "dir"
64-
// like DirectoryLocalVolumeType but it's a symbolic link to directory
64+
// DirectoryLinkLocalVolumeType is like DirectoryLocalVolumeType,
65+
// but it's a symbolic link to directory
6566
DirectoryLinkLocalVolumeType localVolumeType = "dir-link"
66-
// like DirectoryLocalVolumeType but bind mounted
67+
// DirectoryBindMountedLocalVolumeType is like DirectoryLocalVolumeType
68+
// but bind mounted
6769
DirectoryBindMountedLocalVolumeType localVolumeType = "dir-bindmounted"
68-
// like DirectoryLocalVolumeType but it's a symbolic link to self bind mounted directory
70+
// DirectoryLinkBindMountedLocalVolumeType is like DirectoryLocalVolumeType,
71+
// but it's a symbolic link to self bind mounted directory
6972
// Note that bind mounting at symbolic link actually mounts at directory it
7073
// links to.
7174
DirectoryLinkBindMountedLocalVolumeType localVolumeType = "dir-link-bindmounted"
72-
// creates a tmpfs and mounts it
75+
// TmpfsLocalVolumeType creates a tmpfs and mounts it
7376
TmpfsLocalVolumeType localVolumeType = "tmpfs"
74-
// tests based on local ssd at /mnt/disks/by-uuid/
77+
// GCELocalSSDVolumeType tests based on local ssd at /mnt/disks/by-uuid/
7578
GCELocalSSDVolumeType localVolumeType = "gce-localssd-scsi-fs"
76-
// Creates a local file, formats it, and maps it as a block device.
79+
// BlockLocalVolumeType creates a local file, formats it, and maps it as a block device.
7780
BlockLocalVolumeType localVolumeType = "block"
78-
// Creates a local file serving as the backing for block device., formats it,
79-
// and mounts it to use as FS mode local volume.
81+
// BlockFsWithFormatLocalVolumeType creates a local file serving as the backing for block device,
82+
// formats it, and mounts it to use as FS mode local volume.
8083
BlockFsWithFormatLocalVolumeType localVolumeType = "blockfswithformat"
81-
// Creates a local file serving as the backing for block device. do not format it manually,
82-
// and mounts it to use as FS mode local volume.
84+
// BlockFsWithoutFormatLocalVolumeType creates a local file serving as the backing for block device,
85+
// does not format it manually, and mounts it to use as FS mode local volume.
8386
BlockFsWithoutFormatLocalVolumeType localVolumeType = "blockfswithoutformat"
8487
)
8588

@@ -1003,21 +1006,19 @@ func createWriteCmd(testDir string, testFile string, writeTestFileContent string
10031006
// Cleanup the file containing testFileContent.
10041007
deleteTestFileCmd := fmt.Sprintf("rm %s", testFilePath)
10051008
return fmt.Sprintf("%s && %s && %s && %s", writeTestFileCmd, sudoCmd, writeBlockCmd, deleteTestFileCmd)
1006-
} else {
1007-
testFilePath := filepath.Join(testDir, testFile)
1008-
return fmt.Sprintf("mkdir -p %s; echo %s > %s", testDir, writeTestFileContent, testFilePath)
10091009
}
1010+
testFilePath := filepath.Join(testDir, testFile)
1011+
return fmt.Sprintf("mkdir -p %s; echo %s > %s", testDir, writeTestFileContent, testFilePath)
10101012
}
10111013

10121014
func createReadCmd(testFileDir string, testFile string, volumeType localVolumeType) string {
10131015
if volumeType == BlockLocalVolumeType {
10141016
// Create the command to read the beginning of the block device and print it in ascii.
10151017
return fmt.Sprintf("hexdump -n 100 -e '100 \"%%_p\"' %s | head -1", testFileDir)
1016-
} else {
1017-
// Create the command to read (aka cat) a file.
1018-
testFilePath := filepath.Join(testFileDir, testFile)
1019-
return fmt.Sprintf("cat %s", testFilePath)
10201018
}
1019+
// Create the command to read (aka cat) a file.
1020+
testFilePath := filepath.Join(testFileDir, testFile)
1021+
return fmt.Sprintf("cat %s", testFilePath)
10211022
}
10221023

10231024
// Read testFile and evaluate whether it contains the testFileContent

test/e2e/storage/volume_provisioning.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -847,15 +847,15 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() {
847847
framework.SkipIfProviderIs("gke")
848848
ginkgo.By("creating a Gluster DP server Pod")
849849
pod := startGlusterDpServerPod(c, ns)
850-
serverUrl := "http://" + pod.Status.PodIP + ":8081"
850+
serverURL := "http://" + pod.Status.PodIP + ":8081"
851851
ginkgo.By("creating a StorageClass")
852852
test := testsuites.StorageClassTest{
853853
Client: c,
854854
Name: "Gluster Dynamic provisioner test",
855855
Provisioner: "kubernetes.io/glusterfs",
856856
ClaimSize: "2Gi",
857857
ExpectedSize: "2Gi",
858-
Parameters: map[string]string{"resturl": serverUrl},
858+
Parameters: map[string]string{"resturl": serverURL},
859859
}
860860
suffix := fmt.Sprintf("glusterdptest")
861861
test.Class = newStorageClass(test, ns, suffix)
@@ -1206,9 +1206,8 @@ func waitForProvisionedVolumesDeleted(c clientset.Interface, scName string) ([]*
12061206
}
12071207
if len(remainingPVs) > 0 {
12081208
return false, nil // Poll until no PVs remain
1209-
} else {
1210-
return true, nil // No PVs remain
12111209
}
1210+
return true, nil // No PVs remain
12121211
})
12131212
return remainingPVs, err
12141213
}

test/e2e/storage/volumes.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ limitations under the License.
1515
*/
1616

1717
// This test is volumes test for configmap.
18+
1819
package storage
1920

2021
import (

0 commit comments

Comments
 (0)