@@ -27,8 +27,8 @@ import (
27
27
"k8s.io/kubernetes/test/e2e/storage/utils"
28
28
"k8s.io/kubernetes/test/e2e/upgrades"
29
29
30
- . "github.com/onsi/ginkgo"
31
- . "github.com/onsi/gomega"
30
+ "github.com/onsi/ginkgo"
31
+ "github.com/onsi/gomega"
32
32
)
33
33
34
34
const devicePath = "/mnt/volume1"
@@ -43,10 +43,12 @@ type VolumeModeDowngradeTest struct {
43
43
pod * v1.Pod
44
44
}
45
45
46
+ // Name returns the tracking name of the test.
46
47
func (VolumeModeDowngradeTest ) Name () string {
47
48
return "[sig-storage] volume-mode-downgrade"
48
49
}
49
50
51
+ // Skip returns true when this test can be skipped.
50
52
func (t * VolumeModeDowngradeTest ) Skip (upgCtx upgrades.UpgradeContext ) bool {
51
53
if ! framework .ProviderIs ("openstack" , "gce" , "aws" , "gke" , "vsphere" , "azure" ) {
52
54
return true
@@ -72,54 +74,54 @@ func (t *VolumeModeDowngradeTest) Setup(f *framework.Framework) {
72
74
cs := f .ClientSet
73
75
ns := f .Namespace .Name
74
76
75
- By ("Creating a PVC" )
77
+ ginkgo . By ("Creating a PVC" )
76
78
block := v1 .PersistentVolumeBlock
77
79
pvcConfig := framework.PersistentVolumeClaimConfig {
78
80
StorageClassName : nil ,
79
81
VolumeMode : & block ,
80
82
}
81
83
t .pvc = framework .MakePersistentVolumeClaim (pvcConfig , ns )
82
84
t .pvc , err = framework .CreatePVC (cs , ns , t .pvc )
83
- Expect (err ).NotTo (HaveOccurred ())
85
+ gomega . Expect (err ).NotTo (gomega . HaveOccurred ())
84
86
85
87
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 ())
87
89
88
90
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 ())
90
92
91
93
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 ())
93
95
94
- By ("Consuming the PVC before downgrade" )
96
+ ginkgo . By ("Consuming the PVC before downgrade" )
95
97
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 ())
97
99
98
- By ("Checking if PV exists as expected volume mode" )
100
+ ginkgo . By ("Checking if PV exists as expected volume mode" )
99
101
utils .CheckVolumeModeOfPath (t .pod , block , devicePath )
100
102
101
- By ("Checking if read/write to PV works properly" )
103
+ ginkgo . By ("Checking if read/write to PV works properly" )
102
104
utils .CheckReadWriteToPath (t .pod , block , devicePath )
103
105
}
104
106
105
107
// Test waits for the downgrade to complete, and then verifies that a pod can no
106
108
// longer consume the pv as it is not mapped nor mounted into the pod
107
109
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" )
109
111
<- done
110
112
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" )
112
114
utils .VerifyExecInPodFail (t .pod , fmt .Sprintf ("test -e %s" , devicePath ), 1 )
113
115
}
114
116
115
117
// Teardown cleans up any remaining resources.
116
118
func (t * VolumeModeDowngradeTest ) Teardown (f * framework.Framework ) {
117
- By ("Deleting the pod" )
119
+ ginkgo . By ("Deleting the pod" )
118
120
framework .ExpectNoError (framework .DeletePodWithWait (f , f .ClientSet , t .pod ))
119
121
120
- By ("Deleting the PVC" )
122
+ ginkgo . By ("Deleting the PVC" )
121
123
framework .ExpectNoError (f .ClientSet .CoreV1 ().PersistentVolumeClaims (t .pvc .Namespace ).Delete (t .pvc .Name , nil ))
122
124
123
- By ("Waiting for the PV to be deleted" )
125
+ ginkgo . By ("Waiting for the PV to be deleted" )
124
126
framework .ExpectNoError (framework .WaitForPersistentVolumeDeleted (f .ClientSet , t .pv .Name , 5 * time .Second , 20 * time .Minute ))
125
127
}
0 commit comments