Skip to content

Commit

Permalink
allow time for async things to finish in e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lllamnyp committed Jun 25, 2024
1 parent 8d5a5e3 commit 406d189
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"os"
"os/exec"
"sync"
"time"

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

Eventually(func() error {
cmd := exec.Command("kubectl", "get",
"statefulset/test",
"--namespace", namespace,
)
_, err = utils.Run(cmd)
return err
}, time.Second*20, time.Second*2).Should(Succeed())

By("wait for statefulset is ready", func() {
cmd := exec.Command("kubectl", "wait",
"statefulset/test",
Expand Down Expand Up @@ -144,6 +154,15 @@ var _ = Describe("etcd-operator", Ordered, func() {
ExpectWithOffset(1, err).NotTo(HaveOccurred())
})

Eventually(func() error {
cmd := exec.Command("kubectl", "get",
"statefulset/test",
"--namespace", namespace,
)
_, err = utils.Run(cmd)
return err
}, time.Second*20, time.Second*2).Should(Succeed())

By("wait for statefulset is ready", func() {
cmd := exec.Command("kubectl", "wait",
"statefulset/test",
Expand Down Expand Up @@ -192,6 +211,15 @@ var _ = Describe("etcd-operator", Ordered, func() {
ExpectWithOffset(1, err).NotTo(HaveOccurred())
})

Eventually(func() error {
cmd := exec.Command("kubectl", "get",
"statefulset/test",
"--namespace", namespace,
)
_, err = utils.Run(cmd)
return err
}, time.Second*20, time.Second*2).Should(Succeed())

By("wait for statefulset is ready", func() {
cmd := exec.Command("kubectl", "wait",
"statefulset/test",
Expand All @@ -217,8 +245,10 @@ var _ = Describe("etcd-operator", Ordered, func() {
auth := clientv3.NewAuth(client)

By("check root role is created", func() {
_, err = auth.RoleGet(ctx, "root")
Expect(err).NotTo(HaveOccurred())
Eventually(func() error {
_, err = auth.RoleGet(ctx, "root")
return err
}, time.Second*20, time.Second*2).Should(Succeed())
})

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

0 comments on commit 406d189

Please sign in to comment.