mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Merge pull request #85671 from tanjunchen/update-test/e2e/common-to-use-framework
use framework refactor code in test/e2e/common
This commit is contained in:
commit
8be1202f08
@ -66,7 +66,7 @@ var _ = framework.KubeDescribe("Probing container", func() {
|
|||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
isReady, err := testutils.PodRunningReady(p)
|
isReady, err := testutils.PodRunningReady(p)
|
||||||
framework.ExpectNoError(err)
|
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
|
// We assume the pod became ready when the container became ready. This
|
||||||
// is true for a single container pod.
|
// is true for a single container pod.
|
||||||
@ -105,7 +105,7 @@ var _ = framework.KubeDescribe("Probing container", func() {
|
|||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
|
|
||||||
isReady, _ := testutils.PodRunningReady(p)
|
isReady, _ := testutils.PodRunningReady(p)
|
||||||
gomega.Expect(isReady).NotTo(gomega.BeTrue(), "pod should be not ready")
|
framework.ExpectNotEqual(isReady, true, "pod should be not ready")
|
||||||
|
|
||||||
restartCount := getRestartCount(p)
|
restartCount := getRestartCount(p)
|
||||||
gomega.Expect(restartCount == 0).To(gomega.BeTrue(), "pod should have a restart count of 0 but got %v", restartCount)
|
gomega.Expect(restartCount == 0).To(gomega.BeTrue(), "pod should have a restart count of 0 but got %v", restartCount)
|
||||||
|
@ -829,14 +829,14 @@ var _ = framework.KubeDescribe("Pods", func() {
|
|||||||
|
|
||||||
ginkgo.By("submitting the pod to kubernetes")
|
ginkgo.By("submitting the pod to kubernetes")
|
||||||
podClient.CreateSync(pod)
|
podClient.CreateSync(pod)
|
||||||
gomega.Expect(podClient.PodIsReady(podName)).To(gomega.BeFalse(), "Expect pod's Ready condition to be false initially.")
|
framework.ExpectEqual(podClient.PodIsReady(podName), false, "Expect pod's Ready condition to be false initially.")
|
||||||
|
|
||||||
ginkgo.By(fmt.Sprintf("patching pod status with condition %q to true", readinessGate1))
|
ginkgo.By(fmt.Sprintf("patching pod status with condition %q to true", readinessGate1))
|
||||||
_, err := podClient.Patch(podName, types.StrategicMergePatchType, []byte(fmt.Sprintf(patchStatusFmt, readinessGate1, "True")), "status")
|
_, err := podClient.Patch(podName, types.StrategicMergePatchType, []byte(fmt.Sprintf(patchStatusFmt, readinessGate1, "True")), "status")
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
// Sleep for 10 seconds.
|
// Sleep for 10 seconds.
|
||||||
time.Sleep(maxReadyStatusUpdateTolerance)
|
time.Sleep(maxReadyStatusUpdateTolerance)
|
||||||
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")
|
framework.ExpectEqual(podClient.PodIsReady(podName), false, "Expect pod's Ready condition to be false with only one condition in readinessGates equal to True")
|
||||||
|
|
||||||
ginkgo.By(fmt.Sprintf("patching pod status with condition %q to true", readinessGate2))
|
ginkgo.By(fmt.Sprintf("patching pod status with condition %q to true", readinessGate2))
|
||||||
_, err = podClient.Patch(podName, types.StrategicMergePatchType, []byte(fmt.Sprintf(patchStatusFmt, readinessGate2, "True")), "status")
|
_, err = podClient.Patch(podName, types.StrategicMergePatchType, []byte(fmt.Sprintf(patchStatusFmt, readinessGate2, "True")), "status")
|
||||||
|
@ -34,7 +34,6 @@ import (
|
|||||||
utilpointer "k8s.io/utils/pointer"
|
utilpointer "k8s.io/utils/pointer"
|
||||||
|
|
||||||
"github.com/onsi/ginkgo"
|
"github.com/onsi/ginkgo"
|
||||||
"github.com/onsi/gomega"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = ginkgo.Describe("[sig-node] RuntimeClass", func() {
|
var _ = ginkgo.Describe("[sig-node] RuntimeClass", func() {
|
||||||
@ -125,7 +124,7 @@ func expectPodRejection(f *framework.Framework, pod *v1.Pod) {
|
|||||||
} else {
|
} else {
|
||||||
_, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(pod)
|
_, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(pod)
|
||||||
framework.ExpectError(err, "should be forbidden")
|
framework.ExpectError(err, "should be forbidden")
|
||||||
gomega.Expect(apierrs.IsForbidden(err)).To(gomega.BeTrue(), "should be forbidden error")
|
framework.ExpectEqual(apierrs.IsForbidden(err), true, "should be forbidden error")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user