Skip to content

Commit

Permalink
fix e2e
Browse files Browse the repository at this point in the history
Signed-off-by: 守辰 <shouchen.zz@alibaba-inc.com>
  • Loading branch information
furykerry committed Mar 15, 2024
1 parent c33088b commit 5326402
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/docker-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Docker Image CI
on:
workflow_dispatch:

# Declare default permissions as read only.
permissions: read-all

jobs:

build:
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/apps/imagelistpulljobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,12 @@ var _ = SIGDescribe("PullImages", func() {
return job.Status.Desired
}, 3*time.Second, time.Second).Should(gomega.Equal(int32(len(job.Spec.Images))))

ginkgo.By("Wait completed in 180s")
ginkgo.By("Wait completed in 360s")
gomega.Eventually(func() bool {
job, err = testerForImageListPullJob.GetJob(job)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
return job.Status.CompletionTime != nil
}, 180*time.Second, 3*time.Second).Should(gomega.Equal(true))
}, 360*time.Second, 10*time.Second).Should(gomega.Equal(true))
gomega.Expect(job.Status.Succeeded).To(gomega.Equal(int32(len(job.Spec.Images))))

ginkgo.By("Delete job")
Expand Down
5 changes: 3 additions & 2 deletions test/e2e/apps/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ var _ = SIGDescribe("StatefulSet", func() {
gomega.Expect(err).NotTo(gomega.HaveOccurred())

ginkgo.By("InPlace update Pods at the new revision")
sst.WaitForPodNotReady(ss, pods.Items[0].Name)
sst.WaitForPodUpdatedAndRunning(ss, pods.Items[0].Name, currentRevision)
sst.WaitForRunningAndReady(3, ss)
ss = sst.GetStatefulSet(ss.Namespace, ss.Name)
pods = sst.GetPodList(ss)
Expand Down Expand Up @@ -761,8 +761,9 @@ var _ = SIGDescribe("StatefulSet", func() {
gomega.Expect(err).NotTo(gomega.HaveOccurred())

ginkgo.By("InPlace update Pods at the new revision")
sst.WaitForPodNotReady(ss, pods.Items[0].Name)
sst.WaitForPodUpdatedAndRunning(ss, pods.Items[0].Name, currentRevision)
sst.WaitForRunningAndReady(3, ss)

ss = sst.GetStatefulSet(ss.Namespace, ss.Name)
pods = sst.GetPodList(ss)
for i := range pods.Items {
Expand Down
22 changes: 22 additions & 0 deletions test/e2e/framework/statefulset_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,28 @@ func (s *StatefulSetTester) WaitForPodNotReady(set *appsv1beta1.StatefulSet, pod

}

// WaitForPodNotReady waist for the Pod named podName in set to exist and to not have a Ready condition.
func (s *StatefulSetTester) WaitForPodUpdatedAndRunning(set *appsv1beta1.StatefulSet, podName string, currentRevision string) (*appsv1beta1.StatefulSet, *v1.PodList) {
var pods *v1.PodList
s.WaitForState(set, func(set2 *appsv1beta1.StatefulSet, pods2 *v1.PodList) (bool, error) {
set = set2
pods = pods2
for i := range pods.Items {
if pods.Items[i].Name != podName {
continue
}

if pods.Items[i].Labels[apps.StatefulSetRevisionLabel] != currentRevision &&
podutil.IsPodReady(&pods.Items[i]) {
return true, nil
}
return false, nil
}
return false, nil
})
return set, pods
}

// WaitForRollingUpdate waits for all Pods in set to exist and have the correct revision and for the RollingUpdate to
// complete. set must have a RollingUpdateStatefulSetStrategyType.
func (s *StatefulSetTester) WaitForRollingUpdate(set *appsv1beta1.StatefulSet) (*appsv1beta1.StatefulSet, *v1.PodList) {
Expand Down

0 comments on commit 5326402

Please sign in to comment.