Skip to content

Commit 406d189

Browse files
committed
allow time for async things to finish in e2e tests
1 parent 8d5a5e3 commit 406d189

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

test/e2e/e2e_test.go

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"os"
2222
"os/exec"
2323
"sync"
24+
"time"
2425

2526
. "github.com/onsi/ginkgo/v2"
2627
. "github.com/onsi/gomega"
@@ -95,6 +96,15 @@ var _ = Describe("etcd-operator", Ordered, func() {
9596
ExpectWithOffset(1, err).NotTo(HaveOccurred())
9697
})
9798

99+
Eventually(func() error {
100+
cmd := exec.Command("kubectl", "get",
101+
"statefulset/test",
102+
"--namespace", namespace,
103+
)
104+
_, err = utils.Run(cmd)
105+
return err
106+
}, time.Second*20, time.Second*2).Should(Succeed())
107+
98108
By("wait for statefulset is ready", func() {
99109
cmd := exec.Command("kubectl", "wait",
100110
"statefulset/test",
@@ -144,6 +154,15 @@ var _ = Describe("etcd-operator", Ordered, func() {
144154
ExpectWithOffset(1, err).NotTo(HaveOccurred())
145155
})
146156

157+
Eventually(func() error {
158+
cmd := exec.Command("kubectl", "get",
159+
"statefulset/test",
160+
"--namespace", namespace,
161+
)
162+
_, err = utils.Run(cmd)
163+
return err
164+
}, time.Second*20, time.Second*2).Should(Succeed())
165+
147166
By("wait for statefulset is ready", func() {
148167
cmd := exec.Command("kubectl", "wait",
149168
"statefulset/test",
@@ -192,6 +211,15 @@ var _ = Describe("etcd-operator", Ordered, func() {
192211
ExpectWithOffset(1, err).NotTo(HaveOccurred())
193212
})
194213

214+
Eventually(func() error {
215+
cmd := exec.Command("kubectl", "get",
216+
"statefulset/test",
217+
"--namespace", namespace,
218+
)
219+
_, err = utils.Run(cmd)
220+
return err
221+
}, time.Second*20, time.Second*2).Should(Succeed())
222+
195223
By("wait for statefulset is ready", func() {
196224
cmd := exec.Command("kubectl", "wait",
197225
"statefulset/test",
@@ -217,8 +245,10 @@ var _ = Describe("etcd-operator", Ordered, func() {
217245
auth := clientv3.NewAuth(client)
218246

219247
By("check root role is created", func() {
220-
_, err = auth.RoleGet(ctx, "root")
221-
Expect(err).NotTo(HaveOccurred())
248+
Eventually(func() error {
249+
_, err = auth.RoleGet(ctx, "root")
250+
return err
251+
}, time.Second*20, time.Second*2).Should(Succeed())
222252
})
223253

224254
By("check root user is created and has root role", func() {

0 commit comments

Comments
 (0)