diff --git a/test/e2e/common/init_container.go b/test/e2e/common/init_container.go index bcae3eecb9f..54b317aff4d 100644 --- a/test/e2e/common/init_container.go +++ b/test/e2e/common/init_container.go @@ -215,7 +215,7 @@ var _ = framework.KubeDescribe("InitContainer [NodeConformance]", func() { framework.ExpectEqual(len(endPod.Status.InitContainerStatuses), 2) for _, status := range endPod.Status.InitContainerStatuses { - gomega.Expect(status.Ready).To(gomega.BeTrue()) + framework.ExpectEqual(status.Ready, true) gomega.Expect(status.State.Terminated).NotTo(gomega.BeNil()) gomega.Expect(status.State.Terminated.ExitCode).To(gomega.BeZero()) } @@ -285,7 +285,7 @@ var _ = framework.KubeDescribe("InitContainer [NodeConformance]", func() { framework.ExpectEqual(len(endPod.Status.InitContainerStatuses), 2) for _, status := range endPod.Status.InitContainerStatuses { - gomega.Expect(status.Ready).To(gomega.BeTrue()) + framework.ExpectEqual(status.Ready, true) gomega.Expect(status.State.Terminated).NotTo(gomega.BeNil()) gomega.Expect(status.State.Terminated.ExitCode).To(gomega.BeZero()) } diff --git a/test/e2e/storage/vsphere/vsphere_volume_diskformat.go b/test/e2e/storage/vsphere/vsphere_volume_diskformat.go index 1f24de212d4..30bd12b2336 100644 --- a/test/e2e/storage/vsphere/vsphere_volume_diskformat.go +++ b/test/e2e/storage/vsphere/vsphere_volume_diskformat.go @@ -153,7 +153,7 @@ func invokeTest(f *framework.Framework, client clientset.Interface, namespace st framework.ExpectNoError(err) ginkgo.By("Verify Disk Format") - gomega.Expect(verifyDiskFormat(client, nodeName, pv.Spec.VsphereVolume.VolumePath, diskFormat)).To(gomega.BeTrue(), "DiskFormat Verification Failed") + framework.ExpectEqual(verifyDiskFormat(client, nodeName, pv.Spec.VsphereVolume.VolumePath, diskFormat), true, "DiskFormat Verification Failed") var volumePaths []string volumePaths = append(volumePaths, pv.Spec.VsphereVolume.VolumePath) diff --git a/test/e2e_node/critical_pod_test.go b/test/e2e_node/critical_pod_test.go index f374e4e6440..1670a5abf76 100644 --- a/test/e2e_node/critical_pod_test.go +++ b/test/e2e_node/critical_pod_test.go @@ -32,7 +32,6 @@ import ( imageutils "k8s.io/kubernetes/test/utils/image" "github.com/onsi/ginkgo" - "github.com/onsi/gomega" ) const ( @@ -86,7 +85,7 @@ var _ = framework.KubeDescribe("CriticalPod [Serial] [Disruptive] [NodeFeature:C }) _, err = f.ClientSet.SchedulingV1().PriorityClasses().Create(systemCriticalPriority) - gomega.Expect(err == nil || errors.IsAlreadyExists(err)).To(gomega.BeTrue(), "failed to create PriorityClasses with an error: %v", err) + framework.ExpectEqual(err == nil || errors.IsAlreadyExists(err), true, "failed to create PriorityClasses with an error: %v", err) // Create pods, starting with non-critical so that the critical preempts the other pods. f.PodClient().CreateBatch([]*v1.Pod{nonCriticalBestEffort, nonCriticalBurstable, nonCriticalGuaranteed}) @@ -157,9 +156,9 @@ func getTestPod(critical bool, name string, resources v1.ResourceRequirements) * pod.Spec.PriorityClassName = systemCriticalPriorityName pod.Spec.Priority = &value - gomega.Expect(kubelettypes.IsCriticalPod(pod)).To(gomega.BeTrue(), "pod should be a critical pod") + framework.ExpectEqual(kubelettypes.IsCriticalPod(pod), true, "pod should be a critical pod") } else { - gomega.Expect(kubelettypes.IsCriticalPod(pod)).To(gomega.BeFalse(), "pod should not be a critical pod") + framework.ExpectEqual(kubelettypes.IsCriticalPod(pod), false, "pod should not be a critical pod") } return pod } diff --git a/test/e2e_node/e2e_node_suite_test.go b/test/e2e_node/e2e_node_suite_test.go index 0a34fba0402..3a060fbe5cc 100644 --- a/test/e2e_node/e2e_node_suite_test.go +++ b/test/e2e_node/e2e_node_suite_test.go @@ -307,7 +307,7 @@ func getNode(c *clientset.Clientset) (*v1.Node, error) { if nodes == nil { return nil, fmt.Errorf("the node list is nil") } - gomega.Expect(len(nodes.Items) > 1).NotTo(gomega.BeTrue(), "the number of nodes is more than 1.") + framework.ExpectEqual(len(nodes.Items) > 1, false, "the number of nodes is more than 1.") if len(nodes.Items) == 0 { return nil, fmt.Errorf("empty node list: %+v", nodes) } diff --git a/test/e2e_node/eviction_test.go b/test/e2e_node/eviction_test.go index cd6e8dac3ff..d398b491c28 100644 --- a/test/e2e_node/eviction_test.go +++ b/test/e2e_node/eviction_test.go @@ -23,7 +23,7 @@ import ( "strings" "time" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" schedulingv1 "k8s.io/api/scheduling/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/resource" @@ -302,7 +302,7 @@ var _ = framework.KubeDescribe("PriorityMemoryEvictionOrdering [Slow] [Serial] [ }) ginkgo.BeforeEach(func() { _, err := f.ClientSet.SchedulingV1().PriorityClasses().Create(&schedulingv1.PriorityClass{ObjectMeta: metav1.ObjectMeta{Name: highPriorityClassName}, Value: highPriority}) - gomega.Expect(err == nil || errors.IsAlreadyExists(err)).To(gomega.BeTrue()) + framework.ExpectEqual(err == nil || errors.IsAlreadyExists(err), true) }) ginkgo.AfterEach(func() { err := f.ClientSet.SchedulingV1().PriorityClasses().Delete(highPriorityClassName, &metav1.DeleteOptions{}) @@ -359,7 +359,7 @@ var _ = framework.KubeDescribe("PriorityLocalStorageEvictionOrdering [Slow] [Ser }) ginkgo.BeforeEach(func() { _, err := f.ClientSet.SchedulingV1().PriorityClasses().Create(&schedulingv1.PriorityClass{ObjectMeta: metav1.ObjectMeta{Name: highPriorityClassName}, Value: highPriority}) - gomega.Expect(err == nil || errors.IsAlreadyExists(err)).To(gomega.BeTrue()) + framework.ExpectEqual(err == nil || errors.IsAlreadyExists(err), true) }) ginkgo.AfterEach(func() { err := f.ClientSet.SchedulingV1().PriorityClasses().Delete(highPriorityClassName, &metav1.DeleteOptions{}) @@ -412,7 +412,7 @@ var _ = framework.KubeDescribe("PriorityPidEvictionOrdering [Slow] [Serial] [Dis }) ginkgo.BeforeEach(func() { _, err := f.ClientSet.SchedulingV1().PriorityClasses().Create(&schedulingv1.PriorityClass{ObjectMeta: metav1.ObjectMeta{Name: highPriorityClassName}, Value: highPriority}) - gomega.Expect(err == nil || errors.IsAlreadyExists(err)).To(gomega.BeTrue()) + framework.ExpectEqual(err == nil || errors.IsAlreadyExists(err), true) }) ginkgo.AfterEach(func() { err := f.ClientSet.SchedulingV1().PriorityClasses().Delete(highPriorityClassName, &metav1.DeleteOptions{}) @@ -661,7 +661,7 @@ func verifyEvictionEvents(f *framework.Framework, testSpecs []podEvictSpec, expe if expectedStarvedResource != noStarvedResource { // Check the eviction.StarvedResourceKey starved, found := event.Annotations[eviction.StarvedResourceKey] - gomega.Expect(found).To(gomega.BeTrue(), "Expected to find an annotation on the eviction event for pod %s containing the starved resource %s, but it was not found", + framework.ExpectEqual(found, true, "Expected to find an annotation on the eviction event for pod %s containing the starved resource %s, but it was not found", pod.Name, expectedStarvedResource) starvedResource := v1.ResourceName(starved) framework.ExpectEqual(starvedResource, expectedStarvedResource, "Expected to the starved_resource annotation on pod %s to contain %s, but got %s instead", @@ -671,7 +671,7 @@ func verifyEvictionEvents(f *framework.Framework, testSpecs []podEvictSpec, expe if expectedStarvedResource == v1.ResourceMemory { // Check the eviction.OffendingContainersKey offendersString, found := event.Annotations[eviction.OffendingContainersKey] - gomega.Expect(found).To(gomega.BeTrue(), "Expected to find an annotation on the eviction event for pod %s containing the offending containers, but it was not found", + framework.ExpectEqual(found, true, "Expected to find an annotation on the eviction event for pod %s containing the offending containers, but it was not found", pod.Name) offendingContainers := strings.Split(offendersString, ",") framework.ExpectEqual(len(offendingContainers), 1, "Expected to find the offending container's usage in the %s annotation, but no container was found", diff --git a/test/e2e_node/startup_probe_test.go b/test/e2e_node/startup_probe_test.go index 2ff7cad0b4f..336bbd5f141 100644 --- a/test/e2e_node/startup_probe_test.go +++ b/test/e2e_node/startup_probe_test.go @@ -30,7 +30,6 @@ import ( imageutils "k8s.io/kubernetes/test/utils/image" "github.com/onsi/ginkgo" - "github.com/onsi/gomega" ) const ( @@ -179,7 +178,7 @@ var _ = framework.KubeDescribe("StartupProbe [Serial] [Disruptive] [NodeAlphaFea isReady, err := testutils.PodRunningReady(p) framework.ExpectNoError(err) - gomega.Expect(isReady).To(gomega.BeTrue(), "pod should be ready") + framework.ExpectEqual(isReady, true, "pod should be ready") // We assume the pod became ready when the container became ready. This // is true for a single container pod.