mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 00:07:50 +00:00
Merge pull request #119988 from bzsuni/cleanup/e2e/app
[e2e_app] stop using deprecated framework.ExpectNotEqual
This commit is contained in:
commit
3ed537ab46
@ -22,6 +22,8 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/onsi/ginkgo/v2"
|
||||
"github.com/onsi/gomega"
|
||||
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
@ -160,7 +162,7 @@ var _ = SIGDescribe("ControllerRevision [Serial]", func() {
|
||||
framework.Logf("Located ControllerRevision: %q", rev.Name)
|
||||
initialRevision, err = csAppsV1.ControllerRevisions(ns).Get(ctx, rev.Name, metav1.GetOptions{})
|
||||
framework.ExpectNoError(err, "failed to lookup ControllerRevision: %v", err)
|
||||
framework.ExpectNotEqual(initialRevision, nil, "failed to lookup ControllerRevision: %v", initialRevision)
|
||||
gomega.Expect(initialRevision).NotTo(gomega.BeNil(), "failed to lookup ControllerRevision: %v", initialRevision)
|
||||
}
|
||||
|
||||
ginkgo.By(fmt.Sprintf("Patching ControllerRevision %q", initialRevision.Name))
|
||||
|
@ -458,7 +458,7 @@ var _ = SIGDescribe("CronJob", func() {
|
||||
|
||||
// CronJob resource delete operations
|
||||
expectFinalizer := func(cj *batchv1.CronJob, msg string) {
|
||||
framework.ExpectNotEqual(cj.DeletionTimestamp, nil, fmt.Sprintf("expected deletionTimestamp, got nil on step: %q, cronjob: %+v", msg, cj))
|
||||
gomega.Expect(cj.DeletionTimestamp).NotTo(gomega.BeNil(), fmt.Sprintf("expected deletionTimestamp, got nil on step: %q, cronjob: %+v", msg, cj))
|
||||
gomega.Expect(cj.Finalizers).ToNot(gomega.BeEmpty(), "expected finalizers on cronjob, got none on step: %q, cronjob: %+v", msg, cj)
|
||||
}
|
||||
|
||||
|
@ -373,7 +373,7 @@ var _ = SIGDescribe("Daemon set [Serial]", func() {
|
||||
waitForHistoryCreated(ctx, c, ns, label, 2)
|
||||
cur := curHistory(listDaemonHistories(ctx, c, ns, label), ds)
|
||||
framework.ExpectEqual(cur.Revision, int64(2))
|
||||
framework.ExpectNotEqual(cur.Labels[appsv1.DefaultDaemonSetUniqueLabelKey], firstHash)
|
||||
gomega.Expect(cur.Labels).NotTo(gomega.HaveKeyWithValue(appsv1.DefaultDaemonSetUniqueLabelKey, firstHash))
|
||||
checkDaemonSetPodsLabels(listDaemonPods(ctx, c, ns, label), firstHash)
|
||||
})
|
||||
|
||||
@ -486,9 +486,9 @@ var _ = SIGDescribe("Daemon set [Serial]", func() {
|
||||
if len(schedulableNodes.Items) < 2 {
|
||||
framework.ExpectEqual(len(existingPods), 0)
|
||||
} else {
|
||||
framework.ExpectNotEqual(len(existingPods), 0)
|
||||
gomega.Expect(existingPods).NotTo(gomega.BeEmpty())
|
||||
}
|
||||
framework.ExpectNotEqual(len(newPods), 0)
|
||||
gomega.Expect(newPods).NotTo(gomega.BeEmpty())
|
||||
|
||||
framework.Logf("Roll back the DaemonSet before rollout is complete")
|
||||
rollbackDS, err := updateDaemonSetWithRetries(ctx, c, ns, ds.Name, func(update *appsv1.DaemonSet) {
|
||||
|
@ -737,7 +737,7 @@ func testDeleteDeployment(ctx context.Context, f *framework.Framework) {
|
||||
framework.ExpectNoError(err)
|
||||
newRS, err := testutil.GetNewReplicaSet(deployment, c)
|
||||
framework.ExpectNoError(err)
|
||||
framework.ExpectNotEqual(newRS, nilRs)
|
||||
gomega.Expect(newRS).NotTo(gomega.Equal(nilRs))
|
||||
stopDeployment(ctx, c, ns, deploymentName)
|
||||
}
|
||||
|
||||
|
@ -357,7 +357,7 @@ var _ = SIGDescribe("StatefulSet", func() {
|
||||
oldImage := ss.Spec.Template.Spec.Containers[0].Image
|
||||
|
||||
ginkgo.By(fmt.Sprintf("Updating stateful set template: update image from %s to %s", oldImage, newImage))
|
||||
framework.ExpectNotEqual(oldImage, newImage, "Incorrect test setup: should update to a different image")
|
||||
gomega.Expect(oldImage).NotTo(gomega.Equal(newImage), "Incorrect test setup: should update to a different image")
|
||||
ss, err = updateStatefulSetWithRetries(ctx, c, ns, ss.Name, func(update *appsv1.StatefulSet) {
|
||||
update.Spec.Template.Spec.Containers[0].Image = newImage
|
||||
})
|
||||
@ -366,7 +366,7 @@ var _ = SIGDescribe("StatefulSet", func() {
|
||||
ginkgo.By("Creating a new revision")
|
||||
ss = waitForStatus(ctx, c, ss)
|
||||
currentRevision, updateRevision = ss.Status.CurrentRevision, ss.Status.UpdateRevision
|
||||
framework.ExpectNotEqual(currentRevision, updateRevision, "Current revision should not equal update revision during rolling update")
|
||||
gomega.Expect(currentRevision).NotTo(gomega.Equal(updateRevision), "Current revision should not equal update revision during rolling update")
|
||||
|
||||
ginkgo.By("Not applying an update when the partition is greater than the number of replicas")
|
||||
for i := range pods.Items {
|
||||
@ -553,7 +553,7 @@ var _ = SIGDescribe("StatefulSet", func() {
|
||||
oldImage := ss.Spec.Template.Spec.Containers[0].Image
|
||||
|
||||
ginkgo.By(fmt.Sprintf("Updating stateful set template: update image from %s to %s", oldImage, newImage))
|
||||
framework.ExpectNotEqual(oldImage, newImage, "Incorrect test setup: should update to a different image")
|
||||
gomega.Expect(oldImage).NotTo(gomega.Equal(newImage), "Incorrect test setup: should update to a different image")
|
||||
ss, err = updateStatefulSetWithRetries(ctx, c, ns, ss.Name, func(update *appsv1.StatefulSet) {
|
||||
update.Spec.Template.Spec.Containers[0].Image = newImage
|
||||
})
|
||||
@ -562,7 +562,7 @@ var _ = SIGDescribe("StatefulSet", func() {
|
||||
ginkgo.By("Creating a new revision")
|
||||
ss = waitForStatus(ctx, c, ss)
|
||||
currentRevision, updateRevision = ss.Status.CurrentRevision, ss.Status.UpdateRevision
|
||||
framework.ExpectNotEqual(currentRevision, updateRevision, "Current revision should not equal update revision during rolling update")
|
||||
gomega.Expect(currentRevision).NotTo(gomega.Equal(updateRevision), "Current revision should not equal update revision during rolling update")
|
||||
|
||||
ginkgo.By("Recreating Pods at the new revision")
|
||||
deleteStatefulPodAtIndex(ctx, c, 0, ss)
|
||||
@ -1869,7 +1869,7 @@ func rollbackTest(ctx context.Context, c clientset.Interface, ns string, ss *app
|
||||
oldImage := ss.Spec.Template.Spec.Containers[0].Image
|
||||
|
||||
ginkgo.By(fmt.Sprintf("Updating StatefulSet template: update image from %s to %s", oldImage, newImage))
|
||||
framework.ExpectNotEqual(oldImage, newImage, "Incorrect test setup: should update to a different image")
|
||||
gomega.Expect(oldImage).NotTo(gomega.Equal(newImage), "Incorrect test setup: should update to a different image")
|
||||
ss, err = updateStatefulSetWithRetries(ctx, c, ns, ss.Name, func(update *appsv1.StatefulSet) {
|
||||
update.Spec.Template.Spec.Containers[0].Image = newImage
|
||||
})
|
||||
@ -1878,7 +1878,7 @@ func rollbackTest(ctx context.Context, c clientset.Interface, ns string, ss *app
|
||||
ginkgo.By("Creating a new revision")
|
||||
ss = waitForStatus(ctx, c, ss)
|
||||
currentRevision, updateRevision = ss.Status.CurrentRevision, ss.Status.UpdateRevision
|
||||
framework.ExpectNotEqual(currentRevision, updateRevision, "Current revision should not equal update revision during rolling update")
|
||||
gomega.Expect(currentRevision).NotTo(gomega.Equal(updateRevision), "Current revision should not equal update revision during rolling update")
|
||||
|
||||
ginkgo.By("Updating Pods in reverse ordinal order")
|
||||
pods = e2estatefulset.GetPodList(ctx, c, ss)
|
||||
@ -1917,7 +1917,7 @@ func rollbackTest(ctx context.Context, c clientset.Interface, ns string, ss *app
|
||||
ss = waitForStatus(ctx, c, ss)
|
||||
currentRevision, updateRevision = ss.Status.CurrentRevision, ss.Status.UpdateRevision
|
||||
framework.ExpectEqual(priorRevision, updateRevision, "Prior revision should equal update revision during roll back")
|
||||
framework.ExpectNotEqual(currentRevision, updateRevision, "Current revision should not equal update revision during roll back")
|
||||
gomega.Expect(currentRevision).NotTo(gomega.Equal(updateRevision), "Current revision should not equal update revision during roll back")
|
||||
|
||||
ginkgo.By("Rolling back update in reverse ordinal order")
|
||||
pods = e2estatefulset.GetPodList(ctx, c, ss)
|
||||
|
@ -32,6 +32,7 @@ import (
|
||||
admissionapi "k8s.io/pod-security-admission/api"
|
||||
|
||||
"github.com/onsi/ginkgo/v2"
|
||||
"github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -102,7 +103,7 @@ func testFinishedJob(ctx context.Context, f *framework.Framework) {
|
||||
}
|
||||
|
||||
deleteAtUTC := job.ObjectMeta.DeletionTimestamp.UTC()
|
||||
framework.ExpectNotEqual(deleteAtUTC, nil)
|
||||
gomega.Expect(deleteAtUTC).NotTo(gomega.BeNil())
|
||||
|
||||
expireAtUTC := finishTimeUTC.Add(time.Duration(ttl) * time.Second)
|
||||
if deleteAtUTC.Before(expireAtUTC) {
|
||||
|
Loading…
Reference in New Issue
Block a user