Skip to content

Commit 0733f8d

Browse files
committed
fix(tests): fix e2e test
1 parent de873b4 commit 0733f8d

File tree

1 file changed

+12
-21
lines changed

1 file changed

+12
-21
lines changed

tests/e2e/e2e_test.go

+12-21
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,9 @@ var _ = Describe("yatai-image-builder", Ordered, func() {
5353
Context("BentoRequest Operator", func() {
5454
It("Should run successfully", func() {
5555
By("Creating a BentoRequest CR")
56-
EventuallyWithOffset(1, func() error {
57-
cmd := exec.Command("kubectl", "apply", "-f", "tests/e2e/example.yaml")
58-
_, err := utils.Run(cmd)
59-
return err
60-
}, time.Minute, time.Second).Should(Succeed())
56+
cmd := exec.Command("kubectl", "apply", "-f", "tests/e2e/example.yaml")
57+
out, err := utils.Run(cmd)
58+
Expect(err).To(BeNil(), "Failed to create BentoRequest CR: %s", string(out))
6159

6260
By("Sleeping for 5 seconds")
6361
time.Sleep(5 * time.Second)
@@ -94,25 +92,18 @@ var _ = Describe("yatai-image-builder", Ordered, func() {
9492
time.Sleep(5 * time.Second)
9593

9694
By("Checking the generated Bento CR")
97-
EventuallyWithOffset(1, func() error {
98-
ctx := context.Background()
95+
ctx := context.Background()
9996

100-
logrus.Infof("Getting BentoRequest CR %s", "test-bento")
101-
bentoRequest, err := bentorequestcli.BentoRequests("yatai").Get(ctx, "test-bento", metav1.GetOptions{})
102-
if err != nil {
103-
return err
104-
}
97+
logrus.Infof("Getting BentoRequest CR %s", "test-bento")
98+
bentoRequest, err := bentorequestcli.BentoRequests("yatai").Get(ctx, "test-bento", metav1.GetOptions{})
99+
Expect(err).To(BeNil(), "failed to get BentoRequest CR")
105100

106-
logrus.Infof("Getting Bento CR %s", "test-bento")
107-
bento, err := bentorequestcli.Bentoes("yatai").Get(ctx, "test-bento", metav1.GetOptions{})
108-
if err != nil {
109-
return err
110-
}
101+
logrus.Infof("Getting Bento CR %s", "test-bento")
102+
bento, err := bentorequestcli.Bentoes("yatai").Get(ctx, "test-bento", metav1.GetOptions{})
103+
Expect(err).To(BeNil(), "failed to get Bento CR")
111104

112-
Expect(bentoRequest.Spec.BentoTag).To(Equal(bento.Spec.Tag), "BentoRequest and Bento tag should match")
113-
Expect(bento.Spec.Image).To(Not(BeEmpty()), "Bento CR image should not be empty")
114-
return nil
115-
}).Should(Succeed())
105+
Expect(bentoRequest.Spec.BentoTag).To(Equal(bento.Spec.Tag), "BentoRequest and Bento tag should match")
106+
Expect(bento.Spec.Image).To(Not(BeEmpty()), "Bento CR image should not be empty")
116107
})
117108
})
118109
})

0 commit comments

Comments
 (0)