@@ -513,7 +513,7 @@ func getConfigFileFromPod(namespace string, cluster *rabbitmqv1beta1.RabbitmqClu
513
513
"cat" ,
514
514
path ,
515
515
)
516
- Expect ( err ).NotTo (HaveOccurred ())
516
+ ExpectWithOffset ( 1 , err ).NotTo (HaveOccurred ())
517
517
cfg , err := ini .Load (output )
518
518
ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
519
519
return cfg .Section ("" ).KeysHash ()
@@ -566,7 +566,7 @@ func waitForRabbitmqNotRunningWithOffset(cluster *rabbitmqv1beta1.RabbitmqCluste
566
566
)
567
567
568
568
if err != nil {
569
- Expect ( string (output )).To (ContainSubstring ("not found" ))
569
+ ExpectWithOffset ( 1 , string (output )).To (ContainSubstring ("not found" ))
570
570
}
571
571
572
572
return string (output )
@@ -591,7 +591,7 @@ func waitForRabbitmqRunningWithOffset(cluster *rabbitmqv1beta1.RabbitmqCluster,
591
591
)
592
592
593
593
if err != nil {
594
- Expect ( string (output )).To (ContainSubstring ("not found" ))
594
+ ExpectWithOffset ( 1 , string (output )).To (ContainSubstring ("not found" ))
595
595
}
596
596
597
597
return string (output )
@@ -626,7 +626,7 @@ func assertHttpReady(hostname, port string) {
626
626
rabbitURL := fmt .Sprintf ("http://%s:%s" , hostname , port )
627
627
628
628
req , err := http .NewRequest (http .MethodGet , rabbitURL , nil )
629
- Expect ( err ).ToNot (HaveOccurred ())
629
+ ExpectWithOffset ( 1 , err ).ToNot (HaveOccurred ())
630
630
631
631
return client .Do (req )
632
632
}, podCreationTimeout , 5 ).Should (HaveHTTPStatus (http .StatusOK ))
@@ -680,7 +680,7 @@ func k8sSecretExists(secretName, secretNamespace string) (bool, error) {
680
680
)
681
681
682
682
if err != nil {
683
- Expect ( string (output )).To (ContainSubstring ("not found" ))
683
+ ExpectWithOffset ( 1 , string (output )).To (ContainSubstring ("not found" ))
684
684
return false , nil
685
685
}
686
686
@@ -690,9 +690,9 @@ func k8sSecretExists(secretName, secretNamespace string) (bool, error) {
690
690
func k8sCreateTLSSecret (secretName , secretNamespace , certPath , keyPath string ) error {
691
691
// delete secret if it exists
692
692
secretExists , err := k8sSecretExists (secretName , secretNamespace )
693
- Expect ( err ).NotTo (HaveOccurred ())
693
+ ExpectWithOffset ( 1 , err ).NotTo (HaveOccurred ())
694
694
if secretExists {
695
- Expect ( k8sDeleteSecret (secretName , secretNamespace )).To (Succeed ())
695
+ ExpectWithOffset ( 1 , k8sDeleteSecret (secretName , secretNamespace )).To (Succeed ())
696
696
}
697
697
698
698
// create secret
@@ -861,26 +861,26 @@ func publishAndConsumeMQTTMsg(hostname, nodePort, username, password string, ove
861
861
862
862
handler := func (client mqtt.Client , msg mqtt.Message ) {
863
863
defer GinkgoRecover ()
864
- Expect ( msg .Topic ()).To (Equal (topic ))
865
- Expect ( string (msg .Payload ())).To (Equal ("test message MQTT" ))
864
+ ExpectWithOffset ( 1 , msg .Topic ()).To (Equal (topic ))
865
+ ExpectWithOffset ( 1 , string (msg .Payload ())).To (Equal ("test message MQTT" ))
866
866
msgReceived = true
867
867
}
868
868
869
869
token = c .Subscribe (topic , 0 , handler )
870
- Expect ( token .Wait ()).To (BeTrue ())
871
- Expect ( token .Error ()).ToNot (HaveOccurred ())
870
+ ExpectWithOffset ( 1 , token .Wait ()).To (BeTrue ())
871
+ ExpectWithOffset ( 1 , token .Error ()).ToNot (HaveOccurred ())
872
872
873
873
token = c .Publish (topic , 0 , false , "test message MQTT" )
874
- Expect ( token .Wait ()).To (BeTrue ())
875
- Expect ( token .Error ()).ToNot (HaveOccurred ())
874
+ ExpectWithOffset ( 1 , token .Wait ()).To (BeTrue ())
875
+ ExpectWithOffset ( 1 , token .Error ()).ToNot (HaveOccurred ())
876
876
877
- Eventually ( func () bool {
877
+ EventuallyWithOffset ( 1 , func () bool {
878
878
return msgReceived
879
879
}, 5 * time .Second ).Should (BeTrue ())
880
880
881
881
token = c .Unsubscribe (topic )
882
- Expect ( token .Wait ()).To (BeTrue ())
883
- Expect ( token .Error ()).ToNot (HaveOccurred ())
882
+ ExpectWithOffset ( 1 , token .Wait ()).To (BeTrue ())
883
+ ExpectWithOffset ( 1 , token .Error ()).ToNot (HaveOccurred ())
884
884
885
885
c .Disconnect (250 )
886
886
}
@@ -892,7 +892,7 @@ func publishAndConsumeSTOMPMsg(hostname, stompNodePort, username, password strin
892
892
// Create a secure tls.Conn and pass to stomp.Connect, otherwise use Stomp.Dial
893
893
if tlsConfig != nil {
894
894
secureConn , err := tls .Dial ("tcp" , fmt .Sprintf ("%s:%s" , hostname , stompNodePort ), tlsConfig )
895
- Expect ( err ).NotTo (HaveOccurred ())
895
+ ExpectWithOffset ( 1 , err ).NotTo (HaveOccurred ())
896
896
defer secureConn .Close ()
897
897
898
898
for retry := 0 ; retry < 5 ; retry ++ {
@@ -927,26 +927,26 @@ func publishAndConsumeSTOMPMsg(hostname, stompNodePort, username, password strin
927
927
}
928
928
}
929
929
930
- Expect ( err ).ToNot (HaveOccurred ())
930
+ ExpectWithOffset ( 1 , err ).ToNot (HaveOccurred ())
931
931
932
932
queue := "/queue/system-tests-stomp"
933
933
sub , err := conn .Subscribe (queue , stomp .AckAuto )
934
- Expect ( err ).ToNot (HaveOccurred ())
934
+ ExpectWithOffset ( 1 , err ).ToNot (HaveOccurred ())
935
935
936
936
msgReceived := false
937
937
go func () {
938
938
defer GinkgoRecover ()
939
939
var msg * stomp.Message
940
- Eventually ( sub .C , 5 * time .Second ).Should (Receive (& msg ))
941
- Expect ( msg .Err ).ToNot (HaveOccurred ())
942
- Expect ( string (msg .Body )).To (Equal ("test message STOMP" ))
940
+ EventuallyWithOffset ( 1 , sub .C , 5 * time .Second ).Should (Receive (& msg ))
941
+ ExpectWithOffset ( 1 , msg .Err ).ToNot (HaveOccurred ())
942
+ ExpectWithOffset ( 1 , string (msg .Body )).To (Equal ("test message STOMP" ))
943
943
msgReceived = true
944
944
}()
945
945
946
- Expect ( conn .Send (queue , "text/plain" , []byte ("test message STOMP" ), nil )).To (Succeed ())
947
- Eventually ( func () bool {
946
+ ExpectWithOffset ( 1 , conn .Send (queue , "text/plain" , []byte ("test message STOMP" ), nil )).To (Succeed ())
947
+ EventuallyWithOffset ( 1 , func () bool {
948
948
return msgReceived
949
949
}, 5 * time .Second ).Should (BeTrue ())
950
- Expect ( sub .Unsubscribe ()).To (Succeed ())
951
- Expect ( conn .Disconnect ()).To (Succeed ())
950
+ ExpectWithOffset ( 1 , sub .Unsubscribe ()).To (Succeed ())
951
+ ExpectWithOffset ( 1 , conn .Disconnect ()).To (Succeed ())
952
952
}
0 commit comments