Skip to content

Commit 25d2528

Browse files
committed
Use most appropriate matcher
1 parent a1d63dd commit 25d2528

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

system_tests/utils.go

+6-11
Original file line numberDiff line numberDiff line change
@@ -548,20 +548,15 @@ func assertTLSError(cluster *rabbitmqv1beta1.RabbitmqCluster) {
548548
}
549549

550550
func assertHttpReady(hostname, port string) {
551-
EventuallyWithOffset(1, func() int {
551+
EventuallyWithOffset(1, func() (*http.Response, error) {
552552
client := &http.Client{Timeout: 10 * time.Second}
553-
url := fmt.Sprintf("http://%s:%s", hostname, port)
553+
rabbitURL := fmt.Sprintf("http://%s:%s", hostname, port)
554554

555-
req, _ := http.NewRequest(http.MethodGet, url, nil)
555+
req, err := http.NewRequest(http.MethodGet, rabbitURL, nil)
556+
Expect(err).ToNot(HaveOccurred())
556557

557-
resp, err := client.Do(req)
558-
if err != nil {
559-
return 0
560-
}
561-
defer resp.Body.Close()
562-
563-
return resp.StatusCode
564-
}, podCreationTimeout, 5).Should(Equal(http.StatusOK))
558+
return client.Do(req)
559+
}, podCreationTimeout, 5).Should(HaveHTTPStatus(http.StatusOK))
565560
}
566561

567562
func createTLSSecret(secretName, secretNamespace, hostname string) string {

0 commit comments

Comments
 (0)