@@ -57,7 +57,7 @@ import (
5757 . "github.com/onsi/gomega"
5858)
5959
60- const podCreationTimeout = 600 * time .Second
60+ const podCreationTimeout = 10 * time .Minute
6161
6262type featureFlag struct {
6363 Name string
@@ -363,40 +363,26 @@ func getMessageFromQueueAMQPS(username, password, hostname, amqpsPort, caFilePat
363363 return "" , nil
364364}
365365
366- func alivenessTest (rabbitmqHostName , rabbitmqPort , rabbitmqUsername , rabbitmqPassword string ) ( * HealthcheckResponse , error ) {
366+ func alivenessTest (rabbitmqHostName , rabbitmqPort , rabbitmqUsername , rabbitmqPassword string ) * HealthcheckResponse {
367367 client := & http.Client {Timeout : 10 * time .Second }
368368 url := fmt .Sprintf ("http://%s:%s/api/aliveness-test/%%2F" , rabbitmqHostName , rabbitmqPort )
369369
370- req , _ := http .NewRequest (http .MethodGet , url , nil )
370+ req , err := http .NewRequest (http .MethodGet , url , nil )
371+ ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
371372 req .SetBasicAuth (rabbitmqUsername , rabbitmqPassword )
372373
373374 resp , err := client .Do (req )
374- if err != nil {
375- fmt .Printf ("Failed to run cluster aliveness test: %+v \n " , err )
376- return nil , fmt .Errorf ("failed aliveness check: %v with api endpoint: %s" , err , url )
377- }
378-
379- if resp .StatusCode != http .StatusOK {
380- fmt .Printf ("Cluster aliveness test failed. Status: %s \n " , resp .Status )
381- errMessage := fmt .Sprintf ("Response code '%d' != '%d'" , resp .StatusCode , http .StatusOK )
382- return nil , fmt .Errorf ("failed aliveness check: %v with api endpoint: %s, error msg: %s" , err , url , errMessage )
383- }
375+ ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
376+ Expect (resp ).To (HaveHTTPStatus (http .StatusOK ))
384377
385378 defer resp .Body .Close ()
386379 b , err := ioutil .ReadAll (resp .Body )
387- if err != nil {
388- fmt .Printf ("Failed to read cluster aliveness test: %s \n " , err )
389- return nil , fmt .Errorf ("failed aliveness check: %v with api endpoint: %s" , err , url )
390- }
380+ ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
391381
392382 healthcheckResponse := & HealthcheckResponse {}
393- err = json .Unmarshal (b , healthcheckResponse )
394- if err != nil {
395- fmt .Printf ("Failed to umarshal cluster aliveness test result: %s \n " , err )
396- return nil , err
397- }
383+ ExpectWithOffset (1 , json .Unmarshal (b , healthcheckResponse )).To (Succeed ())
398384
399- return healthcheckResponse , nil
385+ return healthcheckResponse
400386}
401387
402388type HealthcheckResponse struct {
0 commit comments