Skip to content

Commit eabc8c5

Browse files
committed
TEST/MEDIUM: e2e: Retry upon connection failures
When connection fails in tests we used to run suite.FailNow which makes the test fails miserably and beating the purpose of suite.Eventually bloc. This was fixed in order to keep retrying the tests inside suite.Eventually even when there is a connection failure
1 parent 1bf6e37 commit eabc8c5

File tree

7 files changed

+14
-7
lines changed

7 files changed

+14
-7
lines changed

deploy/tests/e2e/basic-auth/basic_auth_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ func (suite *HTTPBasicAuthSuite) Test_BasicAuth() {
4141
suite.client.Req.SetBasicAuth(user, "password")
4242
res, cls, err := suite.client.Do()
4343
if err != nil {
44-
suite.FailNow(err.Error())
44+
suite.T().Logf("Connection ERROR: %s", err.Error())
45+
return false
4546
}
4647
defer cls()
4748
return res.StatusCode == http.StatusOK

deploy/tests/e2e/config-snippet/backend_cfg_snippet.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ func (suite *ConfigSnippetSuite) TestBackendCfgSnippet() {
2828
suite.Eventually(func() bool {
2929
res, cls, err := suite.client.Do()
3030
if err != nil {
31-
suite.FailNow(err.Error())
31+
suite.T().Logf("Connection ERROR: %s", err.Error())
32+
return false
3233
}
3334
defer cls()
3435
b, err := ioutil.ReadAll(res.Body)

deploy/tests/e2e/config-snippet/frontend_cfg_snippet.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ func (suite *ConfigSnippetSuite) TestFrontendCfgSnippet() {
2828
suite.Eventually(func() bool {
2929
res, cls, err := suite.client.Do()
3030
if err != nil {
31-
suite.FailNow(err.Error())
31+
suite.T().Logf("Connection ERROR: %s", err.Error())
32+
return false
3233
}
3334
defer cls()
3435
b, err := ioutil.ReadAll(res.Body)

deploy/tests/e2e/rate-limiting/http_rate_limiting_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ func (suite *RateLimitingSuite) Test_Rate_Limiting() {
4747
for responseCode != tc.customStatusCode {
4848
res, cls, err := suite.client.Do()
4949
if err != nil {
50-
suite.FailNow(err.Error())
50+
suite.T().Logf("Connection ERROR: %s", err.Error())
51+
return false
5152
}
5253
defer cls()
5354
if res.StatusCode == 200 {

deploy/tests/e2e/set-header/set_header_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ func (suite *SetHeaderSuite) Test_Request_Set_Header() {
4040
suite.Eventually(func() bool {
4141
res, cls, err := suite.client.Do()
4242
if err != nil {
43-
suite.FailNow(err.Error())
43+
suite.T().Logf("Connection ERROR: %s", err.Error())
44+
return false
4445
}
4546
defer cls()
4647
b, err := ioutil.ReadAll(res.Body)

deploy/tests/e2e/set-header/set_host_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ func (suite *SetHeaderSuite) Test_Set_Host() {
3333
suite.Eventually(func() bool {
3434
res, cls, err := suite.client.Do()
3535
if err != nil {
36-
suite.FailNow(err.Error())
36+
suite.T().Logf("Connection ERROR: %s", err.Error())
37+
return false
3738
}
3839
defer cls()
3940
b, err := ioutil.ReadAll(res.Body)

deploy/tests/e2e/source-ip/source_ip_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ func (suite *SourceIPSuite) Test_Set_Source_Ip() {
4343
}
4444
res, cls, err := suite.client.Do()
4545
if err != nil {
46-
suite.FailNow(err.Error())
46+
suite.T().Logf("Connection ERROR: %s", err.Error())
47+
return false
4748
}
4849
defer cls()
4950
return res.StatusCode != http.StatusOK

0 commit comments

Comments
 (0)