mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #79695 from tanshanshan/e2e-apps
Use ExpectEqual under apps
This commit is contained in:
commit
2054590481
@ -249,7 +249,7 @@ var _ = SIGDescribe("CronJob", func() {
|
||||
jobs, err := f.ClientSet.BatchV1().Jobs(f.Namespace.Name).List(metav1.ListOptions{})
|
||||
framework.ExpectNoError(err, "Failed to ensure a finished cronjob exists by listing jobs explicitly in namespace %s", f.Namespace.Name)
|
||||
_, finishedJobs := filterActiveJobs(jobs)
|
||||
gomega.Expect(len(finishedJobs)).To(gomega.Equal(1))
|
||||
framework.ExpectEqual(len(finishedJobs), 1)
|
||||
|
||||
// Job should get deleted when the next job finishes the next minute
|
||||
ginkgo.By("Ensuring this job and its pods does not exist anymore")
|
||||
@ -262,7 +262,7 @@ var _ = SIGDescribe("CronJob", func() {
|
||||
jobs, err = f.ClientSet.BatchV1().Jobs(f.Namespace.Name).List(metav1.ListOptions{})
|
||||
framework.ExpectNoError(err, "Failed to ensure there is one finished job by listing job explicitly in namespace %s", f.Namespace.Name)
|
||||
_, finishedJobs = filterActiveJobs(jobs)
|
||||
gomega.Expect(len(finishedJobs)).To(gomega.Equal(1))
|
||||
framework.ExpectEqual(len(finishedJobs), 1)
|
||||
|
||||
ginkgo.By("Removing cronjob")
|
||||
err = deleteCronJob(f.ClientSet, f.Namespace.Name, cronJob.Name)
|
||||
|
@ -165,7 +165,7 @@ var _ = SIGDescribe("Daemon set [Serial]", func() {
|
||||
newNode, err := setDaemonSetNodeLabels(c, nodeList.Items[0].Name, nodeSelector)
|
||||
framework.ExpectNoError(err, "error setting labels on node")
|
||||
daemonSetLabels, _ := separateDaemonSetNodeLabels(newNode.Labels)
|
||||
gomega.Expect(len(daemonSetLabels)).To(gomega.Equal(1))
|
||||
framework.ExpectEqual(len(daemonSetLabels), 1)
|
||||
err = wait.PollImmediate(dsRetryPeriod, dsRetryTimeout, checkDaemonPodOnNodes(f, ds, []string{newNode.Name}))
|
||||
framework.ExpectNoError(err, "error waiting for daemon pods to be running on new nodes")
|
||||
err = checkDaemonStatus(f, dsName)
|
||||
@ -184,7 +184,7 @@ var _ = SIGDescribe("Daemon set [Serial]", func() {
|
||||
ds, err = c.AppsV1().DaemonSets(ns).Patch(dsName, types.StrategicMergePatchType, []byte(patch))
|
||||
framework.ExpectNoError(err, "error patching daemon set")
|
||||
daemonSetLabels, _ = separateDaemonSetNodeLabels(greenNode.Labels)
|
||||
gomega.Expect(len(daemonSetLabels)).To(gomega.Equal(1))
|
||||
framework.ExpectEqual(len(daemonSetLabels), 1)
|
||||
err = wait.PollImmediate(dsRetryPeriod, dsRetryTimeout, checkDaemonPodOnNodes(f, ds, []string{greenNode.Name}))
|
||||
framework.ExpectNoError(err, "error waiting for daemon pods to be running on new nodes")
|
||||
err = checkDaemonStatus(f, dsName)
|
||||
@ -228,7 +228,7 @@ var _ = SIGDescribe("Daemon set [Serial]", func() {
|
||||
newNode, err := setDaemonSetNodeLabels(c, nodeList.Items[0].Name, nodeSelector)
|
||||
framework.ExpectNoError(err, "error setting labels on node")
|
||||
daemonSetLabels, _ := separateDaemonSetNodeLabels(newNode.Labels)
|
||||
gomega.Expect(len(daemonSetLabels)).To(gomega.Equal(1))
|
||||
framework.ExpectEqual(len(daemonSetLabels), 1)
|
||||
err = wait.PollImmediate(dsRetryPeriod, dsRetryTimeout, checkDaemonPodOnNodes(f, ds, []string{newNode.Name}))
|
||||
framework.ExpectNoError(err, "error waiting for daemon pods to be running on new nodes")
|
||||
err = checkDaemonStatus(f, dsName)
|
||||
@ -294,7 +294,7 @@ var _ = SIGDescribe("Daemon set [Serial]", func() {
|
||||
waitForHistoryCreated(c, ns, label, 1)
|
||||
first := curHistory(listDaemonHistories(c, ns, label), ds)
|
||||
firstHash := first.Labels[appsv1.DefaultDaemonSetUniqueLabelKey]
|
||||
gomega.Expect(first.Revision).To(gomega.Equal(int64(1)))
|
||||
framework.ExpectEqual(first.Revision, int64(1))
|
||||
checkDaemonSetPodsLabels(listDaemonPods(c, ns, label), firstHash)
|
||||
|
||||
ginkgo.By("Update daemon pods image.")
|
||||
@ -315,7 +315,7 @@ var _ = SIGDescribe("Daemon set [Serial]", func() {
|
||||
framework.ExpectNoError(err)
|
||||
waitForHistoryCreated(c, ns, label, 2)
|
||||
cur := curHistory(listDaemonHistories(c, ns, label), ds)
|
||||
gomega.Expect(cur.Revision).To(gomega.Equal(int64(2)))
|
||||
framework.ExpectEqual(cur.Revision, int64(2))
|
||||
gomega.Expect(cur.Labels[appsv1.DefaultDaemonSetUniqueLabelKey]).NotTo(gomega.Equal(firstHash))
|
||||
checkDaemonSetPodsLabels(listDaemonPods(c, ns, label), firstHash)
|
||||
})
|
||||
@ -343,7 +343,7 @@ var _ = SIGDescribe("Daemon set [Serial]", func() {
|
||||
waitForHistoryCreated(c, ns, label, 1)
|
||||
cur := curHistory(listDaemonHistories(c, ns, label), ds)
|
||||
hash := cur.Labels[appsv1.DefaultDaemonSetUniqueLabelKey]
|
||||
gomega.Expect(cur.Revision).To(gomega.Equal(int64(1)))
|
||||
framework.ExpectEqual(cur.Revision, int64(1))
|
||||
checkDaemonSetPodsLabels(listDaemonPods(c, ns, label), hash)
|
||||
|
||||
ginkgo.By("Update daemon pods image.")
|
||||
@ -372,7 +372,7 @@ var _ = SIGDescribe("Daemon set [Serial]", func() {
|
||||
waitForHistoryCreated(c, ns, label, 2)
|
||||
cur = curHistory(listDaemonHistories(c, ns, label), ds)
|
||||
hash = cur.Labels[appsv1.DefaultDaemonSetUniqueLabelKey]
|
||||
gomega.Expect(cur.Revision).To(gomega.Equal(int64(2)))
|
||||
framework.ExpectEqual(cur.Revision, int64(2))
|
||||
checkDaemonSetPodsLabels(listDaemonPods(c, ns, label), hash)
|
||||
})
|
||||
|
||||
@ -423,7 +423,7 @@ var _ = SIGDescribe("Daemon set [Serial]", func() {
|
||||
}
|
||||
schedulableNodes = framework.GetReadySchedulableNodesOrDie(c)
|
||||
if len(schedulableNodes.Items) < 2 {
|
||||
gomega.Expect(len(existingPods)).To(gomega.Equal(0))
|
||||
framework.ExpectEqual(len(existingPods), 0)
|
||||
} else {
|
||||
gomega.Expect(len(existingPods)).NotTo(gomega.Equal(0))
|
||||
}
|
||||
@ -721,7 +721,7 @@ func checkDaemonSetPodsLabels(podList *v1.PodList, hash string) {
|
||||
podHash := pod.Labels[appsv1.DefaultDaemonSetUniqueLabelKey]
|
||||
gomega.Expect(len(podHash)).To(gomega.BeNumerically(">", 0))
|
||||
if len(hash) > 0 {
|
||||
gomega.Expect(podHash).To(gomega.Equal(hash))
|
||||
framework.ExpectEqual(podHash, hash)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -767,7 +767,7 @@ func curHistory(historyList *appsv1.ControllerRevisionList, ds *appsv1.DaemonSet
|
||||
foundCurHistories++
|
||||
}
|
||||
}
|
||||
gomega.Expect(foundCurHistories).To(gomega.Equal(1))
|
||||
framework.ExpectEqual(foundCurHistories, 1)
|
||||
gomega.Expect(curHistory).NotTo(gomega.BeNil())
|
||||
return curHistory
|
||||
}
|
||||
|
@ -53,9 +53,9 @@ var _ = SIGDescribe("Job", func() {
|
||||
ginkgo.By("Ensuring pods for job exist")
|
||||
pods, err := jobutil.GetJobPods(f.ClientSet, f.Namespace.Name, job.Name)
|
||||
framework.ExpectNoError(err, "failed to get pod list for job in namespace: %s", f.Namespace.Name)
|
||||
gomega.Expect(len(pods.Items)).To(gomega.Equal(int(completions)), "failed to ensure sufficient pod for job: got %d, want %d", len(pods.Items), completions)
|
||||
framework.ExpectEqual(len(pods.Items), int(completions), "failed to ensure sufficient pod for job: got %d, want %d", len(pods.Items), completions)
|
||||
for _, pod := range pods.Items {
|
||||
gomega.Expect(pod.Status.Phase).To(gomega.Equal(v1.PodSucceeded), "failed to ensure pod status: pod %s status %s", pod.Name, pod.Status.Phase)
|
||||
framework.ExpectEqual(pod.Status.Phase, v1.PodSucceeded, "failed to ensure pod status: pod %s status %s", pod.Name, pod.Status.Phase)
|
||||
}
|
||||
})
|
||||
|
||||
@ -234,7 +234,7 @@ var _ = SIGDescribe("Job", func() {
|
||||
e2elog.Failf("Not enough pod created expected at least %d, got %#v", backoff+1, pods.Items)
|
||||
}
|
||||
for _, pod := range pods.Items {
|
||||
gomega.Expect(pod.Status.Phase).To(gomega.Equal(v1.PodFailed))
|
||||
framework.ExpectEqual(pod.Status.Phase, v1.PodFailed)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -44,7 +44,6 @@ import (
|
||||
testutils "k8s.io/kubernetes/test/utils"
|
||||
|
||||
"github.com/onsi/ginkgo"
|
||||
"github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -187,7 +186,7 @@ var _ = SIGDescribe("Network Partition [Disruptive] [Slow]", func() {
|
||||
cache.ResourceEventHandlerFuncs{
|
||||
UpdateFunc: func(oldObj, newObj interface{}) {
|
||||
n, ok := newObj.(*v1.Node)
|
||||
gomega.Expect(ok).To(gomega.Equal(true))
|
||||
framework.ExpectEqual(ok, true)
|
||||
newNode <- n
|
||||
|
||||
},
|
||||
@ -336,7 +335,7 @@ var _ = SIGDescribe("Network Partition [Disruptive] [Slow]", func() {
|
||||
framework.TestUnderTemporaryNetworkFailure(c, ns, node, func() {
|
||||
e2elog.Logf("Waiting for pod %s to be removed", pods.Items[0].Name)
|
||||
err := framework.WaitForRCPodToDisappear(c, ns, name, pods.Items[0].Name)
|
||||
gomega.Expect(err).To(gomega.Equal(wait.ErrWaitTimeout), "Pod was not deleted during network partition.")
|
||||
framework.ExpectEqual(err, wait.ErrWaitTimeout, "Pod was not deleted during network partition.")
|
||||
|
||||
ginkgo.By(fmt.Sprintf("verifying that there are %v running pods during partition", replicas))
|
||||
_, err = e2epod.PodsCreated(c, ns, name, replicas)
|
||||
@ -410,7 +409,7 @@ var _ = SIGDescribe("Network Partition [Disruptive] [Slow]", func() {
|
||||
framework.TestUnderTemporaryNetworkFailure(c, ns, node, func() {
|
||||
e2elog.Logf("Checking that the NodeController does not force delete stateful pods %v", pod.Name)
|
||||
err := e2epod.WaitTimeoutForPodNoLongerRunningInNamespace(c, pod.Name, ns, 10*time.Minute)
|
||||
gomega.Expect(err).To(gomega.Equal(wait.ErrWaitTimeout), "Pod was not deleted during network partition.")
|
||||
framework.ExpectEqual(err, wait.ErrWaitTimeout, "Pod was not deleted during network partition.")
|
||||
})
|
||||
|
||||
e2elog.Logf("Waiting %v for node %s to be ready once temporary network failure ends", resizeNodeReadyTimeout, node.Name)
|
||||
@ -454,7 +453,7 @@ var _ = SIGDescribe("Network Partition [Disruptive] [Slow]", func() {
|
||||
framework.TestUnderTemporaryNetworkFailure(c, ns, node, func() {
|
||||
e2elog.Logf("Waiting for pod %s to be removed", pods.Items[0].Name)
|
||||
err := e2epod.WaitForPodToDisappear(c, ns, pods.Items[0].Name, label, 20*time.Second, 10*time.Minute)
|
||||
gomega.Expect(err).To(gomega.Equal(wait.ErrWaitTimeout), "Pod was not deleted during network partition.")
|
||||
framework.ExpectEqual(err, wait.ErrWaitTimeout, "Pod was not deleted during network partition.")
|
||||
|
||||
ginkgo.By(fmt.Sprintf("verifying that there are now %v running pods", parallelism))
|
||||
_, err = e2epod.PodsCreatedByLabel(c, ns, job.Name, parallelism, label)
|
||||
@ -566,7 +565,7 @@ var _ = SIGDescribe("Network Partition [Disruptive] [Slow]", func() {
|
||||
cache.ResourceEventHandlerFuncs{
|
||||
UpdateFunc: func(oldObj, newObj interface{}) {
|
||||
n, ok := newObj.(*v1.Node)
|
||||
gomega.Expect(ok).To(gomega.Equal(true))
|
||||
framework.ExpectEqual(ok, true)
|
||||
newNode <- n
|
||||
|
||||
},
|
||||
|
@ -156,9 +156,9 @@ var _ = SIGDescribe("StatefulSet", func() {
|
||||
pod := pods.Items[0]
|
||||
controllerRef := metav1.GetControllerOf(&pod)
|
||||
gomega.Expect(controllerRef).ToNot(gomega.BeNil())
|
||||
gomega.Expect(controllerRef.Kind).To(gomega.Equal(ss.Kind))
|
||||
gomega.Expect(controllerRef.Name).To(gomega.Equal(ss.Name))
|
||||
gomega.Expect(controllerRef.UID).To(gomega.Equal(ss.UID))
|
||||
framework.ExpectEqual(controllerRef.Kind, ss.Kind)
|
||||
framework.ExpectEqual(controllerRef.Name, ss.Name)
|
||||
framework.ExpectEqual(controllerRef.UID, ss.UID)
|
||||
|
||||
ginkgo.By("Orphaning one of the stateful set's pods")
|
||||
f.PodClient().Update(pod.Name, func(pod *v1.Pod) {
|
||||
@ -297,17 +297,15 @@ var _ = SIGDescribe("StatefulSet", func() {
|
||||
e2esset.WaitForRunningAndReady(c, *ss.Spec.Replicas, ss)
|
||||
ss = e2esset.WaitForStatus(c, ss)
|
||||
currentRevision, updateRevision := ss.Status.CurrentRevision, ss.Status.UpdateRevision
|
||||
gomega.Expect(currentRevision).To(gomega.Equal(updateRevision),
|
||||
fmt.Sprintf("StatefulSet %s/%s created with update revision %s not equal to current revision %s",
|
||||
ss.Namespace, ss.Name, updateRevision, currentRevision))
|
||||
framework.ExpectEqual(currentRevision, updateRevision, fmt.Sprintf("StatefulSet %s/%s created with update revision %s not equal to current revision %s",
|
||||
ss.Namespace, ss.Name, updateRevision, currentRevision))
|
||||
pods := e2esset.GetPodList(c, ss)
|
||||
for i := range pods.Items {
|
||||
gomega.Expect(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel]).To(gomega.Equal(currentRevision),
|
||||
fmt.Sprintf("Pod %s/%s revision %s is not equal to currentRevision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
currentRevision))
|
||||
framework.ExpectEqual(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel], currentRevision, fmt.Sprintf("Pod %s/%s revision %s is not equal to currentRevision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
currentRevision))
|
||||
}
|
||||
newImage := NewWebserverImage
|
||||
oldImage := ss.Spec.Template.Spec.Containers[0].Image
|
||||
@ -327,18 +325,16 @@ var _ = SIGDescribe("StatefulSet", func() {
|
||||
|
||||
ginkgo.By("Not applying an update when the partition is greater than the number of replicas")
|
||||
for i := range pods.Items {
|
||||
gomega.Expect(pods.Items[i].Spec.Containers[0].Image).To(gomega.Equal(oldImage),
|
||||
fmt.Sprintf("Pod %s/%s has image %s not equal to current image %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Spec.Containers[0].Image,
|
||||
oldImage))
|
||||
gomega.Expect(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel]).To(gomega.Equal(currentRevision),
|
||||
fmt.Sprintf("Pod %s/%s has revision %s not equal to current revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
currentRevision))
|
||||
framework.ExpectEqual(pods.Items[i].Spec.Containers[0].Image, oldImage, fmt.Sprintf("Pod %s/%s has image %s not equal to current image %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Spec.Containers[0].Image,
|
||||
oldImage))
|
||||
framework.ExpectEqual(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel], currentRevision, fmt.Sprintf("Pod %s/%s has revision %s not equal to current revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
currentRevision))
|
||||
}
|
||||
|
||||
ginkgo.By("Performing a canary update")
|
||||
@ -368,31 +364,27 @@ var _ = SIGDescribe("StatefulSet", func() {
|
||||
ss, pods = e2esset.WaitForPartitionedRollingUpdate(c, ss)
|
||||
for i := range pods.Items {
|
||||
if i < int(*ss.Spec.UpdateStrategy.RollingUpdate.Partition) {
|
||||
gomega.Expect(pods.Items[i].Spec.Containers[0].Image).To(gomega.Equal(oldImage),
|
||||
fmt.Sprintf("Pod %s/%s has image %s not equal to current image %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Spec.Containers[0].Image,
|
||||
oldImage))
|
||||
gomega.Expect(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel]).To(gomega.Equal(currentRevision),
|
||||
fmt.Sprintf("Pod %s/%s has revision %s not equal to current revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
currentRevision))
|
||||
framework.ExpectEqual(pods.Items[i].Spec.Containers[0].Image, oldImage, fmt.Sprintf("Pod %s/%s has image %s not equal to current image %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Spec.Containers[0].Image,
|
||||
oldImage))
|
||||
framework.ExpectEqual(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel], currentRevision, fmt.Sprintf("Pod %s/%s has revision %s not equal to current revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
currentRevision))
|
||||
} else {
|
||||
gomega.Expect(pods.Items[i].Spec.Containers[0].Image).To(gomega.Equal(newImage),
|
||||
fmt.Sprintf("Pod %s/%s has image %s not equal to new image %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Spec.Containers[0].Image,
|
||||
newImage))
|
||||
gomega.Expect(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel]).To(gomega.Equal(updateRevision),
|
||||
fmt.Sprintf("Pod %s/%s has revision %s not equal to new revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
updateRevision))
|
||||
framework.ExpectEqual(pods.Items[i].Spec.Containers[0].Image, newImage, fmt.Sprintf("Pod %s/%s has image %s not equal to new image %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Spec.Containers[0].Image,
|
||||
newImage))
|
||||
framework.ExpectEqual(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel], updateRevision, fmt.Sprintf("Pod %s/%s has revision %s not equal to new revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
updateRevision))
|
||||
}
|
||||
}
|
||||
|
||||
@ -404,31 +396,27 @@ var _ = SIGDescribe("StatefulSet", func() {
|
||||
pods = e2esset.GetPodList(c, ss)
|
||||
for i := range pods.Items {
|
||||
if i < int(*ss.Spec.UpdateStrategy.RollingUpdate.Partition) {
|
||||
gomega.Expect(pods.Items[i].Spec.Containers[0].Image).To(gomega.Equal(oldImage),
|
||||
fmt.Sprintf("Pod %s/%s has image %s not equal to current image %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Spec.Containers[0].Image,
|
||||
oldImage))
|
||||
gomega.Expect(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel]).To(gomega.Equal(currentRevision),
|
||||
fmt.Sprintf("Pod %s/%s has revision %s not equal to current revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
currentRevision))
|
||||
framework.ExpectEqual(pods.Items[i].Spec.Containers[0].Image, oldImage, fmt.Sprintf("Pod %s/%s has image %s not equal to current image %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Spec.Containers[0].Image,
|
||||
oldImage))
|
||||
framework.ExpectEqual(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel], currentRevision, fmt.Sprintf("Pod %s/%s has revision %s not equal to current revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
currentRevision))
|
||||
} else {
|
||||
gomega.Expect(pods.Items[i].Spec.Containers[0].Image).To(gomega.Equal(newImage),
|
||||
fmt.Sprintf("Pod %s/%s has image %s not equal to new image %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Spec.Containers[0].Image,
|
||||
newImage))
|
||||
gomega.Expect(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel]).To(gomega.Equal(updateRevision),
|
||||
fmt.Sprintf("Pod %s/%s has revision %s not equal to new revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
updateRevision))
|
||||
framework.ExpectEqual(pods.Items[i].Spec.Containers[0].Image, newImage, fmt.Sprintf("Pod %s/%s has image %s not equal to new image %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Spec.Containers[0].Image,
|
||||
newImage))
|
||||
framework.ExpectEqual(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel], updateRevision, fmt.Sprintf("Pod %s/%s has revision %s not equal to new revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
updateRevision))
|
||||
}
|
||||
}
|
||||
|
||||
@ -449,40 +437,35 @@ var _ = SIGDescribe("StatefulSet", func() {
|
||||
ss, pods = e2esset.WaitForPartitionedRollingUpdate(c, ss)
|
||||
for i := range pods.Items {
|
||||
if i < int(*ss.Spec.UpdateStrategy.RollingUpdate.Partition) {
|
||||
gomega.Expect(pods.Items[i].Spec.Containers[0].Image).To(gomega.Equal(oldImage),
|
||||
fmt.Sprintf("Pod %s/%s has image %s not equal to current image %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Spec.Containers[0].Image,
|
||||
oldImage))
|
||||
gomega.Expect(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel]).To(gomega.Equal(currentRevision),
|
||||
fmt.Sprintf("Pod %s/%s has revision %s not equal to current revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
currentRevision))
|
||||
framework.ExpectEqual(pods.Items[i].Spec.Containers[0].Image, oldImage, fmt.Sprintf("Pod %s/%s has image %s not equal to current image %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Spec.Containers[0].Image,
|
||||
oldImage))
|
||||
framework.ExpectEqual(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel], currentRevision, fmt.Sprintf("Pod %s/%s has revision %s not equal to current revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
currentRevision))
|
||||
} else {
|
||||
gomega.Expect(pods.Items[i].Spec.Containers[0].Image).To(gomega.Equal(newImage),
|
||||
fmt.Sprintf("Pod %s/%s has image %s not equal to new image %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Spec.Containers[0].Image,
|
||||
newImage))
|
||||
gomega.Expect(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel]).To(gomega.Equal(updateRevision),
|
||||
fmt.Sprintf("Pod %s/%s has revision %s not equal to new revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
updateRevision))
|
||||
framework.ExpectEqual(pods.Items[i].Spec.Containers[0].Image, newImage, fmt.Sprintf("Pod %s/%s has image %s not equal to new image %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Spec.Containers[0].Image,
|
||||
newImage))
|
||||
framework.ExpectEqual(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel], updateRevision, fmt.Sprintf("Pod %s/%s has revision %s not equal to new revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
updateRevision))
|
||||
}
|
||||
}
|
||||
}
|
||||
gomega.Expect(ss.Status.CurrentRevision).To(gomega.Equal(updateRevision),
|
||||
fmt.Sprintf("StatefulSet %s/%s current revision %s does not equal update revision %s on update completion",
|
||||
ss.Namespace,
|
||||
ss.Name,
|
||||
ss.Status.CurrentRevision,
|
||||
updateRevision))
|
||||
framework.ExpectEqual(ss.Status.CurrentRevision, updateRevision, fmt.Sprintf("StatefulSet %s/%s current revision %s does not equal update revision %s on update completion",
|
||||
ss.Namespace,
|
||||
ss.Name,
|
||||
ss.Status.CurrentRevision,
|
||||
updateRevision))
|
||||
|
||||
})
|
||||
|
||||
@ -500,17 +483,15 @@ var _ = SIGDescribe("StatefulSet", func() {
|
||||
e2esset.WaitForRunningAndReady(c, *ss.Spec.Replicas, ss)
|
||||
ss = e2esset.WaitForStatus(c, ss)
|
||||
currentRevision, updateRevision := ss.Status.CurrentRevision, ss.Status.UpdateRevision
|
||||
gomega.Expect(currentRevision).To(gomega.Equal(updateRevision),
|
||||
fmt.Sprintf("StatefulSet %s/%s created with update revision %s not equal to current revision %s",
|
||||
ss.Namespace, ss.Name, updateRevision, currentRevision))
|
||||
framework.ExpectEqual(currentRevision, updateRevision, fmt.Sprintf("StatefulSet %s/%s created with update revision %s not equal to current revision %s",
|
||||
ss.Namespace, ss.Name, updateRevision, currentRevision))
|
||||
pods := e2esset.GetPodList(c, ss)
|
||||
for i := range pods.Items {
|
||||
gomega.Expect(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel]).To(gomega.Equal(currentRevision),
|
||||
fmt.Sprintf("Pod %s/%s revision %s is not equal to current revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
currentRevision))
|
||||
framework.ExpectEqual(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel], currentRevision, fmt.Sprintf("Pod %s/%s revision %s is not equal to current revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
currentRevision))
|
||||
}
|
||||
|
||||
ginkgo.By("Restoring Pods to the current revision")
|
||||
@ -521,12 +502,11 @@ var _ = SIGDescribe("StatefulSet", func() {
|
||||
ss = e2esset.GetStatefulSet(c, ss.Namespace, ss.Name)
|
||||
pods = e2esset.GetPodList(c, ss)
|
||||
for i := range pods.Items {
|
||||
gomega.Expect(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel]).To(gomega.Equal(currentRevision),
|
||||
fmt.Sprintf("Pod %s/%s revision %s is not equal to current revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
currentRevision))
|
||||
framework.ExpectEqual(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel], currentRevision, fmt.Sprintf("Pod %s/%s revision %s is not equal to current revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
currentRevision))
|
||||
}
|
||||
newImage := NewWebserverImage
|
||||
oldImage := ss.Spec.Template.Spec.Containers[0].Image
|
||||
@ -552,18 +532,16 @@ var _ = SIGDescribe("StatefulSet", func() {
|
||||
ss = e2esset.GetStatefulSet(c, ss.Namespace, ss.Name)
|
||||
pods = e2esset.GetPodList(c, ss)
|
||||
for i := range pods.Items {
|
||||
gomega.Expect(pods.Items[i].Spec.Containers[0].Image).To(gomega.Equal(newImage),
|
||||
fmt.Sprintf("Pod %s/%s has image %s not equal to new image %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Spec.Containers[0].Image,
|
||||
newImage))
|
||||
gomega.Expect(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel]).To(gomega.Equal(updateRevision),
|
||||
fmt.Sprintf("Pod %s/%s has revision %s not equal to current revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
updateRevision))
|
||||
framework.ExpectEqual(pods.Items[i].Spec.Containers[0].Image, newImage, fmt.Sprintf("Pod %s/%s has image %s not equal to new image %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Spec.Containers[0].Image,
|
||||
newImage))
|
||||
framework.ExpectEqual(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel], updateRevision, fmt.Sprintf("Pod %s/%s has revision %s not equal to current revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
updateRevision))
|
||||
}
|
||||
})
|
||||
|
||||
@ -798,8 +776,8 @@ var _ = SIGDescribe("StatefulSet", func() {
|
||||
if err != nil {
|
||||
e2elog.Failf("Failed to get scale subresource: %v", err)
|
||||
}
|
||||
gomega.Expect(scale.Spec.Replicas).To(gomega.Equal(int32(1)))
|
||||
gomega.Expect(scale.Status.Replicas).To(gomega.Equal(int32(1)))
|
||||
framework.ExpectEqual(scale.Spec.Replicas, int32(1))
|
||||
framework.ExpectEqual(scale.Status.Replicas, int32(1))
|
||||
|
||||
ginkgo.By("updating a scale subresource")
|
||||
scale.Spec.Replicas = 2
|
||||
@ -807,14 +785,14 @@ var _ = SIGDescribe("StatefulSet", func() {
|
||||
if err != nil {
|
||||
e2elog.Failf("Failed to put scale subresource: %v", err)
|
||||
}
|
||||
gomega.Expect(scaleResult.Spec.Replicas).To(gomega.Equal(int32(2)))
|
||||
framework.ExpectEqual(scaleResult.Spec.Replicas, int32(2))
|
||||
|
||||
ginkgo.By("verifying the statefulset Spec.Replicas was modified")
|
||||
ss, err = c.AppsV1().StatefulSets(ns).Get(ssName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
e2elog.Failf("Failed to get statefulset resource: %v", err)
|
||||
}
|
||||
gomega.Expect(*(ss.Spec.Replicas)).To(gomega.Equal(int32(2)))
|
||||
framework.ExpectEqual(*(ss.Spec.Replicas), int32(2))
|
||||
})
|
||||
})
|
||||
|
||||
@ -1085,17 +1063,15 @@ func rollbackTest(c clientset.Interface, ns string, ss *appsv1.StatefulSet) {
|
||||
e2esset.WaitForRunningAndReady(c, *ss.Spec.Replicas, ss)
|
||||
ss = e2esset.WaitForStatus(c, ss)
|
||||
currentRevision, updateRevision := ss.Status.CurrentRevision, ss.Status.UpdateRevision
|
||||
gomega.Expect(currentRevision).To(gomega.Equal(updateRevision),
|
||||
fmt.Sprintf("StatefulSet %s/%s created with update revision %s not equal to current revision %s",
|
||||
ss.Namespace, ss.Name, updateRevision, currentRevision))
|
||||
framework.ExpectEqual(currentRevision, updateRevision, fmt.Sprintf("StatefulSet %s/%s created with update revision %s not equal to current revision %s",
|
||||
ss.Namespace, ss.Name, updateRevision, currentRevision))
|
||||
pods := e2esset.GetPodList(c, ss)
|
||||
for i := range pods.Items {
|
||||
gomega.Expect(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel]).To(gomega.Equal(currentRevision),
|
||||
fmt.Sprintf("Pod %s/%s revision %s is not equal to current revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
currentRevision))
|
||||
framework.ExpectEqual(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel], currentRevision, fmt.Sprintf("Pod %s/%s revision %s is not equal to current revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
currentRevision))
|
||||
}
|
||||
e2esset.SortStatefulPods(pods)
|
||||
err = e2esset.BreakPodHTTPProbe(ss, &pods.Items[1])
|
||||
@ -1124,25 +1100,22 @@ func rollbackTest(c clientset.Interface, ns string, ss *appsv1.StatefulSet) {
|
||||
framework.ExpectNoError(err)
|
||||
ss, pods = e2esset.WaitForPodReady(c, ss, pods.Items[1].Name)
|
||||
ss, pods = e2esset.WaitForRollingUpdate(c, ss)
|
||||
gomega.Expect(ss.Status.CurrentRevision).To(gomega.Equal(updateRevision),
|
||||
fmt.Sprintf("StatefulSet %s/%s current revision %s does not equal update revision %s on update completion",
|
||||
ss.Namespace,
|
||||
ss.Name,
|
||||
ss.Status.CurrentRevision,
|
||||
updateRevision))
|
||||
framework.ExpectEqual(ss.Status.CurrentRevision, updateRevision, fmt.Sprintf("StatefulSet %s/%s current revision %s does not equal update revision %s on update completion",
|
||||
ss.Namespace,
|
||||
ss.Name,
|
||||
ss.Status.CurrentRevision,
|
||||
updateRevision))
|
||||
for i := range pods.Items {
|
||||
gomega.Expect(pods.Items[i].Spec.Containers[0].Image).To(gomega.Equal(newImage),
|
||||
fmt.Sprintf(" Pod %s/%s has image %s not have new image %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Spec.Containers[0].Image,
|
||||
newImage))
|
||||
gomega.Expect(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel]).To(gomega.Equal(updateRevision),
|
||||
fmt.Sprintf("Pod %s/%s revision %s is not equal to update revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
updateRevision))
|
||||
framework.ExpectEqual(pods.Items[i].Spec.Containers[0].Image, newImage, fmt.Sprintf(" Pod %s/%s has image %s not have new image %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Spec.Containers[0].Image,
|
||||
newImage))
|
||||
framework.ExpectEqual(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel], updateRevision, fmt.Sprintf("Pod %s/%s revision %s is not equal to update revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
updateRevision))
|
||||
}
|
||||
|
||||
ginkgo.By("Rolling back to a previous revision")
|
||||
@ -1159,8 +1132,7 @@ func rollbackTest(c clientset.Interface, ns string, ss *appsv1.StatefulSet) {
|
||||
currentRevision, updateRevision = ss.Status.CurrentRevision, ss.Status.UpdateRevision
|
||||
gomega.Expect(currentRevision).NotTo(gomega.Equal(updateRevision),
|
||||
"Current revision should not equal update revision during roll back")
|
||||
gomega.Expect(priorRevision).To(gomega.Equal(updateRevision),
|
||||
"Prior revision should equal update revision during roll back")
|
||||
framework.ExpectEqual(priorRevision, updateRevision, "Prior revision should equal update revision during roll back")
|
||||
|
||||
ginkgo.By("Rolling back update in reverse ordinal order")
|
||||
pods = e2esset.GetPodList(c, ss)
|
||||
@ -1168,25 +1140,22 @@ func rollbackTest(c clientset.Interface, ns string, ss *appsv1.StatefulSet) {
|
||||
e2esset.RestorePodHTTPProbe(ss, &pods.Items[1])
|
||||
ss, pods = e2esset.WaitForPodReady(c, ss, pods.Items[1].Name)
|
||||
ss, pods = e2esset.WaitForRollingUpdate(c, ss)
|
||||
gomega.Expect(ss.Status.CurrentRevision).To(gomega.Equal(priorRevision),
|
||||
fmt.Sprintf("StatefulSet %s/%s current revision %s does not equal prior revision %s on rollback completion",
|
||||
ss.Namespace,
|
||||
ss.Name,
|
||||
ss.Status.CurrentRevision,
|
||||
updateRevision))
|
||||
framework.ExpectEqual(ss.Status.CurrentRevision, priorRevision, fmt.Sprintf("StatefulSet %s/%s current revision %s does not equal prior revision %s on rollback completion",
|
||||
ss.Namespace,
|
||||
ss.Name,
|
||||
ss.Status.CurrentRevision,
|
||||
updateRevision))
|
||||
|
||||
for i := range pods.Items {
|
||||
gomega.Expect(pods.Items[i].Spec.Containers[0].Image).To(gomega.Equal(oldImage),
|
||||
fmt.Sprintf("Pod %s/%s has image %s not equal to previous image %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Spec.Containers[0].Image,
|
||||
oldImage))
|
||||
gomega.Expect(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel]).To(gomega.Equal(priorRevision),
|
||||
fmt.Sprintf("Pod %s/%s revision %s is not equal to prior revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
priorRevision))
|
||||
framework.ExpectEqual(pods.Items[i].Spec.Containers[0].Image, oldImage, fmt.Sprintf("Pod %s/%s has image %s not equal to previous image %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Spec.Containers[0].Image,
|
||||
oldImage))
|
||||
framework.ExpectEqual(pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel], priorRevision, fmt.Sprintf("Pod %s/%s revision %s is not equal to prior revision %s",
|
||||
pods.Items[i].Namespace,
|
||||
pods.Items[i].Name,
|
||||
pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel],
|
||||
priorRevision))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user