Skip to content

Commit 8be1202

Browse files
authored
Merge pull request kubernetes#85671 from tanjunchen/update-test/e2e/common-to-use-framework
use framework refactor code in test/e2e/common
2 parents dcb7daa + 52ac278 commit 8be1202

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

test/e2e/common/container_probe.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ var _ = framework.KubeDescribe("Probing container", func() {
6666
framework.ExpectNoError(err)
6767
isReady, err := testutils.PodRunningReady(p)
6868
framework.ExpectNoError(err)
69-
gomega.Expect(isReady).To(gomega.BeTrue(), "pod should be ready")
69+
framework.ExpectEqual(isReady, true, "pod should be ready")
7070

7171
// We assume the pod became ready when the container became ready. This
7272
// is true for a single container pod.
@@ -105,7 +105,7 @@ var _ = framework.KubeDescribe("Probing container", func() {
105105
framework.ExpectNoError(err)
106106

107107
isReady, _ := testutils.PodRunningReady(p)
108-
gomega.Expect(isReady).NotTo(gomega.BeTrue(), "pod should be not ready")
108+
framework.ExpectNotEqual(isReady, true, "pod should be not ready")
109109

110110
restartCount := getRestartCount(p)
111111
gomega.Expect(restartCount == 0).To(gomega.BeTrue(), "pod should have a restart count of 0 but got %v", restartCount)

test/e2e/common/pods.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -829,14 +829,14 @@ var _ = framework.KubeDescribe("Pods", func() {
829829

830830
ginkgo.By("submitting the pod to kubernetes")
831831
podClient.CreateSync(pod)
832-
gomega.Expect(podClient.PodIsReady(podName)).To(gomega.BeFalse(), "Expect pod's Ready condition to be false initially.")
832+
framework.ExpectEqual(podClient.PodIsReady(podName), false, "Expect pod's Ready condition to be false initially.")
833833

834834
ginkgo.By(fmt.Sprintf("patching pod status with condition %q to true", readinessGate1))
835835
_, err := podClient.Patch(podName, types.StrategicMergePatchType, []byte(fmt.Sprintf(patchStatusFmt, readinessGate1, "True")), "status")
836836
framework.ExpectNoError(err)
837837
// Sleep for 10 seconds.
838838
time.Sleep(maxReadyStatusUpdateTolerance)
839-
gomega.Expect(podClient.PodIsReady(podName)).To(gomega.BeFalse(), "Expect pod's Ready condition to be false with only one condition in readinessGates equal to True")
839+
framework.ExpectEqual(podClient.PodIsReady(podName), false, "Expect pod's Ready condition to be false with only one condition in readinessGates equal to True")
840840

841841
ginkgo.By(fmt.Sprintf("patching pod status with condition %q to true", readinessGate2))
842842
_, err = podClient.Patch(podName, types.StrategicMergePatchType, []byte(fmt.Sprintf(patchStatusFmt, readinessGate2, "True")), "status")

test/e2e/common/runtimeclass.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import (
3434
utilpointer "k8s.io/utils/pointer"
3535

3636
"github.com/onsi/ginkgo"
37-
"github.com/onsi/gomega"
3837
)
3938

4039
var _ = ginkgo.Describe("[sig-node] RuntimeClass", func() {
@@ -125,7 +124,7 @@ func expectPodRejection(f *framework.Framework, pod *v1.Pod) {
125124
} else {
126125
_, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(pod)
127126
framework.ExpectError(err, "should be forbidden")
128-
gomega.Expect(apierrs.IsForbidden(err)).To(gomega.BeTrue(), "should be forbidden error")
127+
framework.ExpectEqual(apierrs.IsForbidden(err), true, "should be forbidden error")
129128
}
130129
}
131130

0 commit comments

Comments
 (0)