Skip to content

Commit 99e4f65

Browse files
authored
Merge pull request kubernetes#85770 from tanjunchen/ExpectExpect-test-e2e-storage
use ExpectEqual of framework in test/e2e/storage
2 parents ac5dc1f + 9eda997 commit 99e4f65

19 files changed

+34
-39
lines changed

test/e2e/storage/external/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ go_library(
2020
"//test/e2e/storage/testsuites:go_default_library",
2121
"//test/e2e/storage/utils:go_default_library",
2222
"//vendor/github.com/onsi/ginkgo:go_default_library",
23-
"//vendor/github.com/onsi/gomega:go_default_library",
2423
"//vendor/github.com/pkg/errors:go_default_library",
2524
],
2625
)

test/e2e/storage/external/external.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import (
3737
"k8s.io/kubernetes/test/e2e/storage/utils"
3838

3939
"github.com/onsi/ginkgo"
40-
"github.com/onsi/gomega"
4140
)
4241

4342
// List of testSuites to be executed for each external driver.
@@ -280,7 +279,7 @@ func (d *driverDefinition) GetDynamicProvisionStorageClass(config *testsuites.Pe
280279
framework.ExpectNoError(err, "patch items")
281280

282281
sc, ok := items[0].(*storagev1.StorageClass)
283-
gomega.Expect(ok).To(gomega.BeTrue(), "storage class from %s", d.StorageClass.FromFile)
282+
framework.ExpectEqual(ok, true, "storage class from %s", d.StorageClass.FromFile)
284283
// Ensure that we can load more than once as required for
285284
// GetDynamicProvisionStorageClass by adding a random suffix.
286285
sc.Name = names.SimpleNameGenerator.GenerateName(sc.Name + "-")

test/e2e/storage/flexvolume_mounted_volume_resize.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ var _ = utils.SIGDescribe("Mounted flexvolume expand[Slow]", func() {
9494
fmt.Printf("storage class creation error: %v\n", err)
9595
}
9696
framework.ExpectNoError(err, "Error creating resizable storage class")
97-
gomega.Expect(*resizableSc.AllowVolumeExpansion).To(gomega.BeTrue())
97+
framework.ExpectEqual(*resizableSc.AllowVolumeExpansion, true)
9898

9999
pvc = e2epv.MakePersistentVolumeClaim(e2epv.PersistentVolumeClaimConfig{
100100
StorageClassName: &(resizableSc.Name),

test/e2e/storage/flexvolume_online_resize.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ var _ = utils.SIGDescribe("Mounted flexvolume volume expand [Slow] [Feature:Expa
8787
fmt.Printf("storage class creation error: %v\n", err)
8888
}
8989
framework.ExpectNoError(err, "Error creating resizable storage class: %v", err)
90-
gomega.Expect(*resizableSc.AllowVolumeExpansion).To(gomega.BeTrue())
90+
framework.ExpectEqual(*resizableSc.AllowVolumeExpansion, true)
9191

9292
pvc = e2epv.MakePersistentVolumeClaim(e2epv.PersistentVolumeClaimConfig{
9393
StorageClassName: &(resizableSc.Name),

test/e2e/storage/mounted_volume_resize.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ var _ = utils.SIGDescribe("Mounted volume expand", func() {
8181
}
8282
resizableSc, err = c.StorageV1().StorageClasses().Create(newStorageClass(test, ns, "resizing"))
8383
framework.ExpectNoError(err, "Error creating resizable storage class")
84-
gomega.Expect(*resizableSc.AllowVolumeExpansion).To(gomega.BeTrue())
84+
framework.ExpectEqual(*resizableSc.AllowVolumeExpansion, true)
8585

8686
pvc = e2epv.MakePersistentVolumeClaim(e2epv.PersistentVolumeClaimConfig{
8787
ClaimSize: test.ClaimSize,

test/e2e/storage/pd.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ var _ = utils.SIGDescribe("Pod Disks", func() {
395395
framework.ExpectNoError(err, fmt.Sprintf("Unable to create gcloud client err=%v", err))
396396
output, err := gceCloud.ListInstanceNames(framework.TestContext.CloudConfig.ProjectID, framework.TestContext.CloudConfig.Zone)
397397
framework.ExpectNoError(err, fmt.Sprintf("Unable to get list of node instances err=%v output=%s", err, output))
398-
gomega.Expect(true, strings.Contains(string(output), string(host0Name)))
398+
framework.ExpectEqual(true, strings.Contains(string(output), string(host0Name)))
399399

400400
ginkgo.By("deleting host0")
401401
err = gceCloud.DeleteInstance(framework.TestContext.CloudConfig.ProjectID, framework.TestContext.CloudConfig.Zone, string(host0Name))
@@ -405,7 +405,7 @@ var _ = utils.SIGDescribe("Pod Disks", func() {
405405
framework.ExpectEqual(numNodes, origNodeCnt, fmt.Sprintf("Requires current node count (%d) to return to original node count (%d)", numNodes, origNodeCnt))
406406
output, err = gceCloud.ListInstanceNames(framework.TestContext.CloudConfig.ProjectID, framework.TestContext.CloudConfig.Zone)
407407
framework.ExpectNoError(err, fmt.Sprintf("Unable to get list of node instances err=%v output=%s", err, output))
408-
gomega.Expect(false, strings.Contains(string(output), string(host0Name)))
408+
framework.ExpectEqual(false, strings.Contains(string(output), string(host0Name)))
409409

410410
} else if disruptOp == deleteNodeObj {
411411
ginkgo.By("deleting host0's node api object")

test/e2e/storage/persistent_volumes-gce.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package storage
1818

1919
import (
2020
"github.com/onsi/ginkgo"
21-
"github.com/onsi/gomega"
2221
v1 "k8s.io/api/core/v1"
2322
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2423
"k8s.io/apimachinery/pkg/labels"
@@ -125,7 +124,7 @@ var _ = utils.SIGDescribe("PersistentVolumes GCEPD", func() {
125124

126125
ginkgo.By("Deleting the Claim")
127126
framework.ExpectNoError(e2epv.DeletePersistentVolumeClaim(c, pvc.Name, ns), "Unable to delete PVC ", pvc.Name)
128-
gomega.Expect(verifyGCEDiskAttached(diskName, node)).To(gomega.BeTrue())
127+
framework.ExpectEqual(verifyGCEDiskAttached(diskName, node), true)
129128

130129
ginkgo.By("Deleting the Pod")
131130
framework.ExpectNoError(e2epod.DeletePodWithWait(c, clientPod), "Failed to delete pod ", clientPod.Name)
@@ -140,7 +139,7 @@ var _ = utils.SIGDescribe("PersistentVolumes GCEPD", func() {
140139

141140
ginkgo.By("Deleting the Persistent Volume")
142141
framework.ExpectNoError(e2epv.DeletePersistentVolume(c, pv.Name), "Failed to delete PV ", pv.Name)
143-
gomega.Expect(verifyGCEDiskAttached(diskName, node)).To(gomega.BeTrue())
142+
framework.ExpectEqual(verifyGCEDiskAttached(diskName, node), true)
144143

145144
ginkgo.By("Deleting the client pod")
146145
framework.ExpectNoError(e2epod.DeletePodWithWait(c, clientPod), "Failed to delete pod ", clientPod.Name)

test/e2e/storage/persistent_volumes-local.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ func setupLocalVolumes(config *localTestConfig, localVolumeType localVolumeType,
806806
vols := []*localTestVolume{}
807807
for i := 0; i < count; i++ {
808808
ltrType, ok := setupLocalVolumeMap[localVolumeType]
809-
gomega.Expect(ok).To(gomega.BeTrue())
809+
framework.ExpectEqual(ok, true)
810810
ltr := config.ltrMgr.Create(node, ltrType, nil)
811811
vols = append(vols, &localTestVolume{
812812
ltr: ltr,

test/e2e/storage/testsuites/provisioning.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ func (t StorageClassTest) checkProvisioning(client clientset.Interface, claim *v
324324
break
325325
}
326326
}
327-
gomega.Expect(found).To(gomega.BeTrue())
327+
framework.ExpectEqual(found, true)
328328
}
329329

330330
framework.ExpectEqual(pv.Spec.ClaimRef.Name, claim.ObjectMeta.Name)

test/e2e/storage/utils/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ func KubeletCommand(kOp KubeletOpt, c clientset.Interface, pod *v1.Pod) {
199199
break
200200
}
201201
}
202-
gomega.Expect(isPidChanged).To(gomega.BeTrue(), "Kubelet PID remained unchanged after restarting Kubelet")
202+
framework.ExpectEqual(isPidChanged, true, "Kubelet PID remained unchanged after restarting Kubelet")
203203
framework.Logf("Noticed that kubelet PID is changed. Waiting for 30 Seconds for Kubelet to come back")
204204
time.Sleep(30 * time.Second)
205205
}

0 commit comments

Comments
 (0)