diff --git a/test/e2e/storage/csi_mock_volume.go b/test/e2e/storage/csi_mock_volume.go index 032ff9b227b..8478c45d70d 100644 --- a/test/e2e/storage/csi_mock_volume.go +++ b/test/e2e/storage/csi_mock_volume.go @@ -463,7 +463,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() { framework.ExpectNoError(err, "while waiting for PVC resize to finish") pvcConditions := pvc.Status.Conditions - gomega.Expect(len(pvcConditions)).To(gomega.Equal(0), "pvc should not have conditions") + framework.ExpectEqual(len(pvcConditions), 0, "pvc should not have conditions") } // if node expansion is not required PVC should be resized as well @@ -476,7 +476,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() { inProgressConditions := pvc.Status.Conditions if len(inProgressConditions) > 0 { - gomega.Expect(inProgressConditions[0].Type).To(gomega.Equal(v1.PersistentVolumeClaimFileSystemResizePending), "pvc must have fs resizing condition") + framework.ExpectEqual(inProgressConditions[0].Type, v1.PersistentVolumeClaimFileSystemResizePending, "pvc must have fs resizing condition") } ginkgo.By("Deleting the previously created pod") @@ -548,7 +548,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() { framework.ExpectNoError(err, "while waiting for PVC to finish") pvcConditions := pvc.Status.Conditions - gomega.Expect(len(pvcConditions)).To(gomega.Equal(0), "pvc should not have conditions") + framework.ExpectEqual(len(pvcConditions), 0, "pvc should not have conditions") }) } diff --git a/test/e2e/storage/external/external.go b/test/e2e/storage/external/external.go index 3b712dd252a..7231ec2d534 100644 --- a/test/e2e/storage/external/external.go +++ b/test/e2e/storage/external/external.go @@ -243,7 +243,7 @@ func (d *driverDefinition) GetDynamicProvisionStorageClass(config *testsuites.Pe items, err := f.LoadFromManifests(d.StorageClass.FromFile) framework.ExpectNoError(err, "load storage class from %s", d.StorageClass.FromFile) - gomega.Expect(len(items)).To(gomega.Equal(1), "exactly one item from %s", d.StorageClass.FromFile) + framework.ExpectEqual(len(items), 1, "exactly one item from %s", d.StorageClass.FromFile) err = f.PatchItems(items...) framework.ExpectNoError(err, "patch items") diff --git a/test/e2e/storage/flexvolume_mounted_volume_resize.go b/test/e2e/storage/flexvolume_mounted_volume_resize.go index 689af6ea71f..310655e969d 100644 --- a/test/e2e/storage/flexvolume_mounted_volume_resize.go +++ b/test/e2e/storage/flexvolume_mounted_volume_resize.go @@ -142,7 +142,7 @@ var _ = utils.SIGDescribe("Mounted flexvolume expand[Slow]", func() { pvs, err = framework.WaitForPVClaimBoundPhase(c, pvcClaims, framework.ClaimProvisionTimeout) framework.ExpectNoError(err, "Failed waiting for PVC to be bound %v", err) - gomega.Expect(len(pvs)).To(gomega.Equal(1)) + framework.ExpectEqual(len(pvs), 1) ginkgo.By("Creating a deployment with the provisioned volume") deployment, err := e2edeploy.CreateDeployment(c, int32(1), map[string]string{"test": "app"}, nodeKeyValueLabel, ns, pvcClaims, "") @@ -182,6 +182,6 @@ var _ = utils.SIGDescribe("Mounted flexvolume expand[Slow]", func() { framework.ExpectNoError(err, "while waiting for fs resize to finish") pvcConditions := pvc.Status.Conditions - gomega.Expect(len(pvcConditions)).To(gomega.Equal(0), "pvc should not have conditions") + framework.ExpectEqual(len(pvcConditions), 0, "pvc should not have conditions") }) }) diff --git a/test/e2e/storage/flexvolume_online_resize.go b/test/e2e/storage/flexvolume_online_resize.go index fb44670e8eb..e10262c9689 100644 --- a/test/e2e/storage/flexvolume_online_resize.go +++ b/test/e2e/storage/flexvolume_online_resize.go @@ -141,7 +141,7 @@ var _ = utils.SIGDescribe("Mounted flexvolume volume expand [Slow] [Feature:Expa pvs, err = framework.WaitForPVClaimBoundPhase(c, pvcClaims, framework.ClaimProvisionTimeout) framework.ExpectNoError(err, "Failed waiting for PVC to be bound %v", err) - gomega.Expect(len(pvs)).To(gomega.Equal(1)) + framework.ExpectEqual(len(pvs), 1) var pod *v1.Pod ginkgo.By("Creating pod") @@ -173,6 +173,6 @@ var _ = utils.SIGDescribe("Mounted flexvolume volume expand [Slow] [Feature:Expa framework.ExpectNoError(err, "while waiting for fs resize to finish") pvcConditions := pvc.Status.Conditions - gomega.Expect(len(pvcConditions)).To(gomega.Equal(0), "pvc should not have conditions") + framework.ExpectEqual(len(pvcConditions), 0, "pvc should not have conditions") }) }) diff --git a/test/e2e/storage/generic_persistent_volume-disruptive.go b/test/e2e/storage/generic_persistent_volume-disruptive.go index bec7ccd361c..3916cfc05b2 100644 --- a/test/e2e/storage/generic_persistent_volume-disruptive.go +++ b/test/e2e/storage/generic_persistent_volume-disruptive.go @@ -18,7 +18,6 @@ package storage import ( "github.com/onsi/ginkgo" - "github.com/onsi/gomega" v1 "k8s.io/api/core/v1" clientset "k8s.io/client-go/kubernetes" @@ -97,7 +96,7 @@ func createPodPVCFromSC(f *framework.Framework, c clientset.Interface, ns string pvcClaims := []*v1.PersistentVolumeClaim{pvc} pvs, err := framework.WaitForPVClaimBoundPhase(c, pvcClaims, framework.ClaimProvisionTimeout) framework.ExpectNoError(err, "Failed waiting for PVC to be bound %v", err) - gomega.Expect(len(pvs)).To(gomega.Equal(1)) + framework.ExpectEqual(len(pvs), 1) ginkgo.By("Creating a pod with dynamically provisioned volume") pod, err := framework.CreateNginxPod(c, ns, nil, pvcClaims) diff --git a/test/e2e/storage/mounted_volume_resize.go b/test/e2e/storage/mounted_volume_resize.go index 7379f1983e7..33ff97e853a 100644 --- a/test/e2e/storage/mounted_volume_resize.go +++ b/test/e2e/storage/mounted_volume_resize.go @@ -124,7 +124,7 @@ var _ = utils.SIGDescribe("Mounted volume expand", func() { ginkgo.By("Checking for bound PVC") pvs, err := framework.WaitForPVClaimBoundPhase(c, pvcClaims, framework.ClaimProvisionTimeout) framework.ExpectNoError(err, "Failed waiting for PVC to be bound %v", err) - gomega.Expect(len(pvs)).To(gomega.Equal(1)) + framework.ExpectEqual(len(pvs), 1) ginkgo.By("Expanding current pvc") newSize := resource.MustParse("6Gi") @@ -159,7 +159,7 @@ var _ = utils.SIGDescribe("Mounted volume expand", func() { framework.ExpectNoError(err, "while waiting for fs resize to finish") pvcConditions := pvc.Status.Conditions - gomega.Expect(len(pvcConditions)).To(gomega.Equal(0), "pvc should not have conditions") + framework.ExpectEqual(len(pvcConditions), 0, "pvc should not have conditions") }) }) diff --git a/test/e2e/storage/pd.go b/test/e2e/storage/pd.go index f6edf410a78..e89978477fa 100644 --- a/test/e2e/storage/pd.go +++ b/test/e2e/storage/pd.go @@ -397,7 +397,7 @@ var _ = utils.SIGDescribe("Pod Disks", func() { framework.ExpectNoError(err, fmt.Sprintf("Failed to delete host0Pod: err=%v", err)) ginkgo.By("expecting host0 node to be re-created") numNodes := countReadyNodes(cs, host0Name) - gomega.Expect(numNodes).To(gomega.Equal(origNodeCnt), fmt.Sprintf("Requires current node count (%d) to return to original node count (%d)", numNodes, origNodeCnt)) + framework.ExpectEqual(numNodes, origNodeCnt, fmt.Sprintf("Requires current node count (%d) to return to original node count (%d)", numNodes, origNodeCnt)) output, err = gceCloud.ListInstanceNames(framework.TestContext.CloudConfig.ProjectID, framework.TestContext.CloudConfig.Zone) framework.ExpectNoError(err, fmt.Sprintf("Unable to get list of node instances err=%v output=%s", err, output)) gomega.Expect(false, strings.Contains(string(output), string(host0Name))) @@ -470,7 +470,7 @@ func verifyPDContentsViaContainer(f *framework.Framework, podName, containerName break } } - gomega.Expect(strings.TrimSpace(value)).To(gomega.Equal(strings.TrimSpace(expectedContents))) + framework.ExpectEqual(strings.TrimSpace(value), strings.TrimSpace(expectedContents)) } } diff --git a/test/e2e/storage/persistent_volumes-local.go b/test/e2e/storage/persistent_volumes-local.go index 39338cd534a..468fb128a0d 100644 --- a/test/e2e/storage/persistent_volumes-local.go +++ b/test/e2e/storage/persistent_volumes-local.go @@ -849,7 +849,7 @@ func verifyLocalPod(config *localTestConfig, volume *localTestVolume, pod *v1.Po podNodeName, err := podNodeName(config, pod) framework.ExpectNoError(err) e2elog.Logf("pod %q created on Node %q", pod.Name, podNodeName) - gomega.Expect(podNodeName).To(gomega.Equal(expectedNodeName)) + framework.ExpectEqual(podNodeName, expectedNodeName) } func makeLocalPVCConfig(config *localTestConfig, volumeType localVolumeType) framework.PersistentVolumeClaimConfig { @@ -930,7 +930,7 @@ func createLocalPVCsPVs(config *localTestConfig, volumes []*localTestVolume, mod for _, volume := range volumes { pvc, err := config.client.CoreV1().PersistentVolumeClaims(volume.pvc.Namespace).Get(volume.pvc.Name, metav1.GetOptions{}) framework.ExpectNoError(err) - gomega.Expect(pvc.Status.Phase).To(gomega.Equal(v1.ClaimPending)) + framework.ExpectEqual(pvc.Status.Phase, v1.ClaimPending) } return false, nil }) @@ -1165,10 +1165,10 @@ func validateStatefulSet(config *localTestConfig, ss *appsv1.StatefulSet, anti b if anti { // Verify that each pod is on a different node - gomega.Expect(nodes.Len()).To(gomega.Equal(len(pods.Items))) + framework.ExpectEqual(nodes.Len(), len(pods.Items)) } else { // Verify that all pods are on same node. - gomega.Expect(nodes.Len()).To(gomega.Equal(1)) + framework.ExpectEqual(nodes.Len(), 1) } // Validate all PVCs are bound diff --git a/test/e2e/storage/regional_pd.go b/test/e2e/storage/regional_pd.go index d15f52fbc86..3c749783200 100644 --- a/test/e2e/storage/regional_pd.go +++ b/test/e2e/storage/regional_pd.go @@ -269,8 +269,7 @@ func testZonalFailover(c clientset.Interface, ns string) { } ginkgo.By("verifying the same PVC is used by the new pod") - gomega.Expect(getPVC(c, ns, regionalPDLabels).Name).To(gomega.Equal(pvc.Name), - "The same PVC should be used after failover.") + framework.ExpectEqual(getPVC(c, ns, regionalPDLabels).Name, pvc.Name, "The same PVC should be used after failover.") ginkgo.By("verifying the container output has 2 lines, indicating the pod has been created twice using the same regional PD.") logs, err := e2epod.GetPodLogs(c, ns, pod.Name, "") @@ -278,8 +277,7 @@ func testZonalFailover(c clientset.Interface, ns string) { "Error getting logs from pod %s in namespace %s", pod.Name, ns) lineCount := len(strings.Split(strings.TrimSpace(logs), "\n")) expectedLineCount := 2 - gomega.Expect(lineCount).To(gomega.Equal(expectedLineCount), - "Line count of the written file should be %d.", expectedLineCount) + framework.ExpectEqual(lineCount, expectedLineCount, "Line count of the written file should be %d.", expectedLineCount) } @@ -426,7 +424,7 @@ func getPVC(c clientset.Interface, ns string, pvcLabels map[string]string) *v1.P options := metav1.ListOptions{LabelSelector: selector.String()} pvcList, err := c.CoreV1().PersistentVolumeClaims(ns).List(options) framework.ExpectNoError(err) - gomega.Expect(len(pvcList.Items)).To(gomega.Equal(1), "There should be exactly 1 PVC matched.") + framework.ExpectEqual(len(pvcList.Items), 1, "There should be exactly 1 PVC matched.") return &pvcList.Items[0] } @@ -436,7 +434,7 @@ func getPod(c clientset.Interface, ns string, podLabels map[string]string) *v1.P options := metav1.ListOptions{LabelSelector: selector.String()} podList, err := c.CoreV1().Pods(ns).List(options) framework.ExpectNoError(err) - gomega.Expect(len(podList.Items)).To(gomega.Equal(1), "There should be exactly 1 pod matched.") + framework.ExpectEqual(len(podList.Items), 1, "There should be exactly 1 pod matched.") return &podList.Items[0] } diff --git a/test/e2e/storage/testsuites/provisioning.go b/test/e2e/storage/testsuites/provisioning.go index f4640f1f4ee..d302666785a 100644 --- a/test/e2e/storage/testsuites/provisioning.go +++ b/test/e2e/storage/testsuites/provisioning.go @@ -237,12 +237,12 @@ func (t StorageClassTest) TestDynamicProvisioning() *v1.PersistentVolume { var err error if class != nil { - gomega.Expect(*claim.Spec.StorageClassName).To(gomega.Equal(class.Name)) + framework.ExpectEqual(*claim.Spec.StorageClassName, class.Name) ginkgo.By("creating a StorageClass " + class.Name) _, err = client.StorageV1().StorageClasses().Create(class) // The "should provision storage with snapshot data source" test already has created the class. // TODO: make class creation optional and remove the IsAlreadyExists exception - gomega.Expect(err == nil || apierrs.IsAlreadyExists(err)).To(gomega.Equal(true)) + framework.ExpectEqual(err == nil || apierrs.IsAlreadyExists(err), true) class, err = client.StorageV1().StorageClasses().Get(class.Name, metav1.GetOptions{}) framework.ExpectNoError(err) defer func() { @@ -300,11 +300,11 @@ func (t StorageClassTest) checkProvisioning(client clientset.Interface, claim *v // Check sizes expectedCapacity := resource.MustParse(t.ExpectedSize) pvCapacity := pv.Spec.Capacity[v1.ResourceName(v1.ResourceStorage)] - gomega.Expect(pvCapacity.Value()).To(gomega.Equal(expectedCapacity.Value()), "pvCapacity is not equal to expectedCapacity") + framework.ExpectEqual(pvCapacity.Value(), expectedCapacity.Value(), "pvCapacity is not equal to expectedCapacity") requestedCapacity := resource.MustParse(t.ClaimSize) claimCapacity := claim.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)] - gomega.Expect(claimCapacity.Value()).To(gomega.Equal(requestedCapacity.Value()), "claimCapacity is not equal to requestedCapacity") + framework.ExpectEqual(claimCapacity.Value(), requestedCapacity.Value(), "claimCapacity is not equal to requestedCapacity") // Check PV properties ginkgo.By("checking the PV") @@ -322,17 +322,17 @@ func (t StorageClassTest) checkProvisioning(client clientset.Interface, claim *v gomega.Expect(found).To(gomega.BeTrue()) } - gomega.Expect(pv.Spec.ClaimRef.Name).To(gomega.Equal(claim.ObjectMeta.Name)) - gomega.Expect(pv.Spec.ClaimRef.Namespace).To(gomega.Equal(claim.ObjectMeta.Namespace)) + framework.ExpectEqual(pv.Spec.ClaimRef.Name, claim.ObjectMeta.Name) + framework.ExpectEqual(pv.Spec.ClaimRef.Namespace, claim.ObjectMeta.Namespace) if class == nil { - gomega.Expect(pv.Spec.PersistentVolumeReclaimPolicy).To(gomega.Equal(v1.PersistentVolumeReclaimDelete)) + framework.ExpectEqual(pv.Spec.PersistentVolumeReclaimPolicy, v1.PersistentVolumeReclaimDelete) } else { - gomega.Expect(pv.Spec.PersistentVolumeReclaimPolicy).To(gomega.Equal(*class.ReclaimPolicy)) - gomega.Expect(pv.Spec.MountOptions).To(gomega.Equal(class.MountOptions)) + framework.ExpectEqual(pv.Spec.PersistentVolumeReclaimPolicy, *class.ReclaimPolicy) + framework.ExpectEqual(pv.Spec.MountOptions, class.MountOptions) } if claim.Spec.VolumeMode != nil { gomega.Expect(pv.Spec.VolumeMode).NotTo(gomega.BeNil()) - gomega.Expect(*pv.Spec.VolumeMode).To(gomega.Equal(*claim.Spec.VolumeMode)) + framework.ExpectEqual(*pv.Spec.VolumeMode, *claim.Spec.VolumeMode) } return pv } @@ -404,7 +404,7 @@ func PVWriteReadSingleNodeCheck(client clientset.Interface, claim *v1.Persistent // // This is a common test that can be called from a StorageClassTest.PvCheck. func PVMultiNodeCheck(client clientset.Interface, claim *v1.PersistentVolumeClaim, node framework.NodeSelection) { - gomega.Expect(node.Name).To(gomega.Equal(""), "this test only works when not locked onto a single node") + framework.ExpectEqual(node.Name, "", "this test only works when not locked onto a single node") var pod *v1.Pod defer func() { @@ -526,7 +526,7 @@ func (t StorageClassTest) TestBindingWaitForFirstConsumerMultiPVC(claims []*v1.P framework.ExpectNoError(err) pvs = append(pvs, pv) } - gomega.Expect(len(pvs)).To(gomega.Equal(len(createdClaims))) + framework.ExpectEqual(len(pvs), len(createdClaims)) return pvs, node } @@ -608,7 +608,7 @@ func verifyPVCsPending(client clientset.Interface, pvcs []*v1.PersistentVolumeCl // Get new copy of the claim claim, err := client.CoreV1().PersistentVolumeClaims(claim.Namespace).Get(claim.Name, metav1.GetOptions{}) framework.ExpectNoError(err) - gomega.Expect(claim.Status.Phase).To(gomega.Equal(v1.ClaimPending)) + framework.ExpectEqual(claim.Status.Phase, v1.ClaimPending) } } diff --git a/test/e2e/storage/testsuites/snapshottable.go b/test/e2e/storage/testsuites/snapshottable.go index 6f246915974..6a818c606e0 100644 --- a/test/e2e/storage/testsuites/snapshottable.go +++ b/test/e2e/storage/testsuites/snapshottable.go @@ -21,7 +21,6 @@ import ( "time" "github.com/onsi/ginkgo" - "github.com/onsi/gomega" v1 "k8s.io/api/core/v1" apierrs "k8s.io/apimachinery/pkg/api/errors" @@ -75,7 +74,7 @@ func (s *snapshottableTestSuite) defineTests(driver TestDriver, pattern testpatt ginkgo.BeforeEach(func() { // Check preconditions. - gomega.Expect(pattern.SnapshotType).To(gomega.Equal(testpatterns.DynamicCreatedSnapshot)) + framework.ExpectEqual(pattern.SnapshotType, testpatterns.DynamicCreatedSnapshot) dInfo := driver.GetDriverInfo() ok := false sDriver, ok = driver.(SnapshottableTestDriver) @@ -185,10 +184,10 @@ func (s *snapshottableTestSuite) defineTests(driver TestDriver, pattern testpatt // Check SnapshotContent properties ginkgo.By("checking the SnapshotContent") - gomega.Expect(snapshotContentSpec["snapshotClassName"]).To(gomega.Equal(vsc.GetName())) - gomega.Expect(volumeSnapshotRef["name"]).To(gomega.Equal(snapshot.GetName())) - gomega.Expect(volumeSnapshotRef["namespace"]).To(gomega.Equal(snapshot.GetNamespace())) - gomega.Expect(persistentVolumeRef["name"]).To(gomega.Equal(pv.Name)) + framework.ExpectEqual(snapshotContentSpec["snapshotClassName"], vsc.GetName()) + framework.ExpectEqual(volumeSnapshotRef["name"], snapshot.GetName()) + framework.ExpectEqual(volumeSnapshotRef["namespace"], snapshot.GetNamespace()) + framework.ExpectEqual(persistentVolumeRef["name"], pv.Name) }) } diff --git a/test/e2e/storage/utils/utils.go b/test/e2e/storage/utils/utils.go index 6c5fb6e94a5..414aca58a74 100644 --- a/test/e2e/storage/utils/utils.go +++ b/test/e2e/storage/utils/utils.go @@ -90,7 +90,7 @@ func VerifyExecInPodFail(pod *v1.Pod, bashExec string, exitCode int) { if err != nil { if err, ok := err.(uexec.CodeExitError); ok { actualExitCode := err.ExitStatus() - gomega.Expect(actualExitCode).To(gomega.Equal(exitCode), + framework.ExpectEqual(actualExitCode, exitCode, "%q should fail with exit code %d, but failed with exit code %d and error message %q", bashExec, exitCode, actualExitCode, err) } else { diff --git a/test/e2e/storage/volume_expand.go b/test/e2e/storage/volume_expand.go index 081904e7a86..342b0f3ec9f 100644 --- a/test/e2e/storage/volume_expand.go +++ b/test/e2e/storage/volume_expand.go @@ -96,7 +96,7 @@ var _ = utils.SIGDescribe("Volume expand", func() { pvcClaims := []*v1.PersistentVolumeClaim{pvc} pvs, err := framework.WaitForPVClaimBoundPhase(c, pvcClaims, framework.ClaimProvisionTimeout) framework.ExpectNoError(err, "Failed waiting for PVC to be bound %v", err) - gomega.Expect(len(pvs)).To(gomega.Equal(1)) + framework.ExpectEqual(len(pvs), 1) ginkgo.By("Expanding non-expandable pvc") newSize := resource.MustParse("6Gi") @@ -112,7 +112,7 @@ var _ = utils.SIGDescribe("Volume expand", func() { pvcClaims := []*v1.PersistentVolumeClaim{pvc} pvs, err := framework.WaitForPVClaimBoundPhase(c, pvcClaims, framework.ClaimProvisionTimeout) framework.ExpectNoError(err, "Failed waiting for PVC to be bound %v", err) - gomega.Expect(len(pvs)).To(gomega.Equal(1)) + framework.ExpectEqual(len(pvs), 1) ginkgo.By("Creating a pod with dynamically provisioned volume") pod, err := framework.CreatePod(c, ns, nil, pvcClaims, false, "") @@ -147,8 +147,8 @@ var _ = utils.SIGDescribe("Volume expand", func() { framework.ExpectNoError(err, "While fetching pvc after controller resize") inProgressConditions := pvc.Status.Conditions - gomega.Expect(len(inProgressConditions)).To(gomega.Equal(1), "pvc must have file system resize pending condition") - gomega.Expect(inProgressConditions[0].Type).To(gomega.Equal(v1.PersistentVolumeClaimFileSystemResizePending), "pvc must have fs resizing condition") + framework.ExpectEqual(len(inProgressConditions), 1, "pvc must have file system resize pending condition") + framework.ExpectEqual(inProgressConditions[0].Type, v1.PersistentVolumeClaimFileSystemResizePending, "pvc must have fs resizing condition") ginkgo.By("Creating a new pod with same volume") pod2, err := framework.CreatePod(c, ns, nil, pvcClaims, false, "") @@ -163,7 +163,7 @@ var _ = utils.SIGDescribe("Volume expand", func() { framework.ExpectNoError(err, "while waiting for fs resize to finish") pvcConditions := pvc.Status.Conditions - gomega.Expect(len(pvcConditions)).To(gomega.Equal(0), "pvc should not have conditions") + framework.ExpectEqual(len(pvcConditions), 0, "pvc should not have conditions") }) ginkgo.It("should resize volume when PVC is edited while pod is using it", func() { @@ -174,7 +174,7 @@ var _ = utils.SIGDescribe("Volume expand", func() { pvcClaims := []*v1.PersistentVolumeClaim{pvc} pvs, err := framework.WaitForPVClaimBoundPhase(c, pvcClaims, framework.ClaimProvisionTimeout) framework.ExpectNoError(err, "Failed waiting for PVC to be bound %v", err) - gomega.Expect(len(pvs)).To(gomega.Equal(1)) + framework.ExpectEqual(len(pvs), 1) ginkgo.By("Creating a pod with dynamically provisioned volume") pod, err := framework.CreatePod(c, ns, nil, pvcClaims, false, "") @@ -205,7 +205,7 @@ var _ = utils.SIGDescribe("Volume expand", func() { framework.ExpectNoError(err, "while waiting for fs resize to finish") pvcConditions := pvc.Status.Conditions - gomega.Expect(len(pvcConditions)).To(gomega.Equal(0), "pvc should not have conditions") + framework.ExpectEqual(len(pvcConditions), 0, "pvc should not have conditions") }) ginkgo.It("should allow expansion of block volumes", func() { @@ -215,7 +215,7 @@ var _ = utils.SIGDescribe("Volume expand", func() { pvcClaims := []*v1.PersistentVolumeClaim{pvc} pvs, err := framework.WaitForPVClaimBoundPhase(c, pvcClaims, framework.ClaimProvisionTimeout) framework.ExpectNoError(err, "Failed waiting for PVC to be bound %v", err) - gomega.Expect(len(pvs)).To(gomega.Equal(1)) + framework.ExpectEqual(len(pvs), 1) ginkgo.By("Expanding current pvc") newSize := resource.MustParse("6Gi") @@ -237,7 +237,7 @@ var _ = utils.SIGDescribe("Volume expand", func() { framework.ExpectNoError(err, "while waiting for fs resize to finish") pvcConditions := pvc.Status.Conditions - gomega.Expect(len(pvcConditions)).To(gomega.Equal(0), "pvc should not have conditions") + framework.ExpectEqual(len(pvcConditions), 0, "pvc should not have conditions") }) }) diff --git a/test/e2e/storage/volume_metrics.go b/test/e2e/storage/volume_metrics.go index e99996b92c8..8e64eeb82da 100644 --- a/test/e2e/storage/volume_metrics.go +++ b/test/e2e/storage/volume_metrics.go @@ -415,8 +415,7 @@ var _ = utils.SIGDescribe("[Serial] Volume metrics", func() { // should be 4, and the elements should be bound pv count, unbound pv count, bound // pvc count, unbound pvc count in turn. validator := func(metricValues []map[string]int64) { - gomega.Expect(len(metricValues)).To(gomega.Equal(4), - "Wrong metric size: %d", len(metricValues)) + framework.ExpectEqual(len(metricValues), 4, "Wrong metric size: %d", len(metricValues)) controllerMetrics, err := metricsGrabber.GrabFromControllerManager() framework.ExpectNoError(err, "Error getting c-m metricValues: %v", err) @@ -431,8 +430,7 @@ var _ = utils.SIGDescribe("[Serial] Volume metrics", func() { // test suit are equal to expectValues. actualValues := calculateRelativeValues(originMetricValues[i], getPVControllerMetrics(controllerMetrics, metric.name, metric.dimension)) - gomega.Expect(actualValues).To(gomega.Equal(expectValues), - "Wrong pv controller metric %s(%s): wanted %v, got %v", + framework.ExpectEqual(actualValues, expectValues, "Wrong pv controller metric %s(%s): wanted %v, got %v", metric.name, metric.dimension, expectValues, actualValues) } } @@ -660,7 +658,7 @@ func findVolumeStatMetric(metricKeyName string, namespace string, pvcName string } } } - gomega.Expect(errCount).To(gomega.Equal(0), "Found invalid samples") + framework.ExpectEqual(errCount, 0, "Found invalid samples") return found } diff --git a/test/e2e/storage/volume_provisioning.go b/test/e2e/storage/volume_provisioning.go index ff6c3c7953b..7159a4e221c 100644 --- a/test/e2e/storage/volume_provisioning.go +++ b/test/e2e/storage/volume_provisioning.go @@ -804,7 +804,7 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() { e2elog.Logf(err.Error()) claim, err = c.CoreV1().PersistentVolumeClaims(ns).Get(claim.Name, metav1.GetOptions{}) framework.ExpectNoError(err) - gomega.Expect(claim.Status.Phase).To(gomega.Equal(v1.ClaimPending)) + framework.ExpectEqual(claim.Status.Phase, v1.ClaimPending) }) // Modifying the default storage class can be disruptive to other tests that depend on it @@ -838,7 +838,7 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() { e2elog.Logf(err.Error()) claim, err = c.CoreV1().PersistentVolumeClaims(ns).Get(claim.Name, metav1.GetOptions{}) framework.ExpectNoError(err) - gomega.Expect(claim.Status.Phase).To(gomega.Equal(v1.ClaimPending)) + framework.ExpectEqual(claim.Status.Phase, v1.ClaimPending) }) }) @@ -985,7 +985,7 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() { func verifyDefaultStorageClass(c clientset.Interface, scName string, expectedDefault bool) { sc, err := c.StorageV1().StorageClasses().Get(scName, metav1.GetOptions{}) framework.ExpectNoError(err) - gomega.Expect(storageutil.IsDefaultAnnotation(sc.ObjectMeta)).To(gomega.Equal(expectedDefault)) + framework.ExpectEqual(storageutil.IsDefaultAnnotation(sc.ObjectMeta), expectedDefault) } func updateDefaultStorageClass(c clientset.Interface, scName string, defaultStr string) { diff --git a/test/e2e/storage/vsphere/vsphere_volume_disksize.go b/test/e2e/storage/vsphere/vsphere_volume_disksize.go index 3289b0eebcb..cd81756635e 100644 --- a/test/e2e/storage/vsphere/vsphere_volume_disksize.go +++ b/test/e2e/storage/vsphere/vsphere_volume_disksize.go @@ -20,7 +20,6 @@ import ( "time" "github.com/onsi/ginkgo" - "github.com/onsi/gomega" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -91,6 +90,6 @@ var _ = utils.SIGDescribe("Volume Disk Size [Feature:vsphere]", func() { ginkgo.By("Verifying if provisioned PV has the correct size") expectedCapacity := resource.MustParse(expectedDiskSize) pvCapacity := pv.Spec.Capacity[v1.ResourceName(v1.ResourceStorage)] - gomega.Expect(pvCapacity.Value()).To(gomega.Equal(expectedCapacity.Value())) + framework.ExpectEqual(pvCapacity.Value(), expectedCapacity.Value()) }) })