Skip to content

Commit 7c8498a

Browse files
committed
fix golint failures for test/e2e/upgrades/storage
1 parent 8916cca commit 7c8498a

File tree

3 files changed

+26
-24
lines changed

3 files changed

+26
-24
lines changed

hack/.golint_failures

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,6 @@ test/e2e/storage/utils
688688
test/e2e/storage/vsphere
689689
test/e2e/ui
690690
test/e2e/upgrades
691-
test/e2e/upgrades/storage
692691
test/e2e/windows
693692
test/e2e_kubeadm
694693
test/e2e_node

test/e2e/upgrades/storage/persistent_volumes.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import (
2121
utilerrors "k8s.io/apimachinery/pkg/util/errors"
2222
"k8s.io/kubernetes/test/e2e/framework"
2323

24-
. "github.com/onsi/ginkgo"
25-
. "github.com/onsi/gomega"
24+
"github.com/onsi/ginkgo"
25+
"github.com/onsi/gomega"
2626
"k8s.io/kubernetes/test/e2e/upgrades"
2727
)
2828

@@ -33,6 +33,7 @@ type PersistentVolumeUpgradeTest struct {
3333
pvc *v1.PersistentVolumeClaim
3434
}
3535

36+
// Name returns the tracking name of the test.
3637
func (PersistentVolumeUpgradeTest) Name() string { return "[sig-storage] persistent-volume-upgrade" }
3738

3839
const (
@@ -55,7 +56,7 @@ func (t *PersistentVolumeUpgradeTest) Setup(f *framework.Framework) {
5556

5657
ns := f.Namespace.Name
5758

58-
By("Initializing PV source")
59+
ginkgo.By("Initializing PV source")
5960
t.pvSource, _ = framework.CreateGCEVolume()
6061
pvConfig := framework.PersistentVolumeConfig{
6162
NamePrefix: "pv-upgrade",
@@ -65,20 +66,20 @@ func (t *PersistentVolumeUpgradeTest) Setup(f *framework.Framework) {
6566
emptyStorageClass := ""
6667
pvcConfig := framework.PersistentVolumeClaimConfig{StorageClassName: &emptyStorageClass}
6768

68-
By("Creating the PV and PVC")
69+
ginkgo.By("Creating the PV and PVC")
6970
t.pv, t.pvc, err = framework.CreatePVPVC(f.ClientSet, pvConfig, pvcConfig, ns, true)
70-
Expect(err).NotTo(HaveOccurred())
71+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
7172
framework.ExpectNoError(framework.WaitOnPVandPVC(f.ClientSet, ns, t.pv, t.pvc))
7273

73-
By("Consuming the PV before upgrade")
74+
ginkgo.By("Consuming the PV before upgrade")
7475
t.testPod(f, pvWriteCmd+";"+pvReadCmd)
7576
}
7677

7778
// Test waits for the upgrade to complete, and then verifies that a pod can still consume the pv
7879
// and that the volume data persists.
7980
func (t *PersistentVolumeUpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade upgrades.UpgradeType) {
8081
<-done
81-
By("Consuming the PV after upgrade")
82+
ginkgo.By("Consuming the PV after upgrade")
8283
t.testPod(f, pvReadCmd)
8384
}
8485

test/e2e/upgrades/storage/volume_mode.go

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import (
2727
"k8s.io/kubernetes/test/e2e/storage/utils"
2828
"k8s.io/kubernetes/test/e2e/upgrades"
2929

30-
. "github.com/onsi/ginkgo"
31-
. "github.com/onsi/gomega"
30+
"github.com/onsi/ginkgo"
31+
"github.com/onsi/gomega"
3232
)
3333

3434
const devicePath = "/mnt/volume1"
@@ -43,10 +43,12 @@ type VolumeModeDowngradeTest struct {
4343
pod *v1.Pod
4444
}
4545

46+
// Name returns the tracking name of the test.
4647
func (VolumeModeDowngradeTest) Name() string {
4748
return "[sig-storage] volume-mode-downgrade"
4849
}
4950

51+
// Skip returns true when this test can be skipped.
5052
func (t *VolumeModeDowngradeTest) Skip(upgCtx upgrades.UpgradeContext) bool {
5153
if !framework.ProviderIs("openstack", "gce", "aws", "gke", "vsphere", "azure") {
5254
return true
@@ -72,54 +74,54 @@ func (t *VolumeModeDowngradeTest) Setup(f *framework.Framework) {
7274
cs := f.ClientSet
7375
ns := f.Namespace.Name
7476

75-
By("Creating a PVC")
77+
ginkgo.By("Creating a PVC")
7678
block := v1.PersistentVolumeBlock
7779
pvcConfig := framework.PersistentVolumeClaimConfig{
7880
StorageClassName: nil,
7981
VolumeMode: &block,
8082
}
8183
t.pvc = framework.MakePersistentVolumeClaim(pvcConfig, ns)
8284
t.pvc, err = framework.CreatePVC(cs, ns, t.pvc)
83-
Expect(err).NotTo(HaveOccurred())
85+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
8486

8587
err = framework.WaitForPersistentVolumeClaimPhase(v1.ClaimBound, cs, ns, t.pvc.Name, framework.Poll, framework.ClaimProvisionTimeout)
86-
Expect(err).NotTo(HaveOccurred())
88+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
8789

8890
t.pvc, err = cs.CoreV1().PersistentVolumeClaims(t.pvc.Namespace).Get(t.pvc.Name, metav1.GetOptions{})
89-
Expect(err).NotTo(HaveOccurred())
91+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
9092

9193
t.pv, err = cs.CoreV1().PersistentVolumes().Get(t.pvc.Spec.VolumeName, metav1.GetOptions{})
92-
Expect(err).NotTo(HaveOccurred())
94+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
9395

94-
By("Consuming the PVC before downgrade")
96+
ginkgo.By("Consuming the PVC before downgrade")
9597
t.pod, err = framework.CreateSecPod(cs, ns, []*v1.PersistentVolumeClaim{t.pvc}, false, "", false, false, framework.SELinuxLabel, nil, framework.PodStartTimeout)
96-
Expect(err).NotTo(HaveOccurred())
98+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
9799

98-
By("Checking if PV exists as expected volume mode")
100+
ginkgo.By("Checking if PV exists as expected volume mode")
99101
utils.CheckVolumeModeOfPath(t.pod, block, devicePath)
100102

101-
By("Checking if read/write to PV works properly")
103+
ginkgo.By("Checking if read/write to PV works properly")
102104
utils.CheckReadWriteToPath(t.pod, block, devicePath)
103105
}
104106

105107
// Test waits for the downgrade to complete, and then verifies that a pod can no
106108
// longer consume the pv as it is not mapped nor mounted into the pod
107109
func (t *VolumeModeDowngradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade upgrades.UpgradeType) {
108-
By("Waiting for downgrade to finish")
110+
ginkgo.By("Waiting for downgrade to finish")
109111
<-done
110112

111-
By("Verifying that nothing exists at the device path in the pod")
113+
ginkgo.By("Verifying that nothing exists at the device path in the pod")
112114
utils.VerifyExecInPodFail(t.pod, fmt.Sprintf("test -e %s", devicePath), 1)
113115
}
114116

115117
// Teardown cleans up any remaining resources.
116118
func (t *VolumeModeDowngradeTest) Teardown(f *framework.Framework) {
117-
By("Deleting the pod")
119+
ginkgo.By("Deleting the pod")
118120
framework.ExpectNoError(framework.DeletePodWithWait(f, f.ClientSet, t.pod))
119121

120-
By("Deleting the PVC")
122+
ginkgo.By("Deleting the PVC")
121123
framework.ExpectNoError(f.ClientSet.CoreV1().PersistentVolumeClaims(t.pvc.Namespace).Delete(t.pvc.Name, nil))
122124

123-
By("Waiting for the PV to be deleted")
125+
ginkgo.By("Waiting for the PV to be deleted")
124126
framework.ExpectNoError(framework.WaitForPersistentVolumeDeleted(f.ClientSet, t.pv.Name, 5*time.Second, 20*time.Minute))
125127
}

0 commit comments

Comments
 (0)