Skip to content

Commit ea3ffa0

Browse files
committed
TEST/MINOR: fix usage of testify NoError
the way we were using suite.NoError was not stopping the test in case of error. Fixing this.
1 parent 957d3d3 commit ea3ffa0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+137
-137
lines changed

deploy/tests/e2e/access-control/access_control_test.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func (suite *AccessControlSuite) Test_Whitelist() {
4444
{"allow-list", " 192.168.2.0/24"},
4545
}
4646

47-
suite.NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
47+
suite.Require().NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
4848

4949
suite.eventuallyReturns("192.168.2.3", http.StatusOK)
5050
suite.eventuallyReturns("192.168.5.3", http.StatusForbidden)
@@ -57,7 +57,7 @@ func (suite *AccessControlSuite) Test_Whitelist() {
5757
{"whitelist", "192.168.4.0/24"},
5858
}
5959

60-
suite.NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
60+
suite.Require().NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
6161

6262
suite.eventuallyReturns("192.168.4.3", http.StatusOK)
6363
suite.eventuallyReturns("192.168.5.3", http.StatusForbidden)
@@ -71,7 +71,7 @@ func (suite *AccessControlSuite) Test_Whitelist() {
7171
{"allow-list", "192.168.5.0/24"},
7272
}
7373

74-
suite.NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
74+
suite.Require().NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
7575

7676
suite.eventuallyReturns("192.168.5.3", http.StatusOK)
7777
suite.eventuallyReturns("192.168.4.3", http.StatusForbidden)
@@ -84,8 +84,8 @@ func (suite *AccessControlSuite) Test_Whitelist() {
8484
{"allow-list", " patterns/ips"},
8585
}
8686

87-
suite.NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
88-
suite.NoError(suite.test.Apply("config/patternfile-a.yml", "", nil))
87+
suite.Require().NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
88+
suite.Require().NoError(suite.test.Apply("config/patternfile-a.yml", "", nil))
8989

9090
suite.eventuallyReturns("192.168.0.3", http.StatusOK)
9191
suite.eventuallyReturns("192.168.2.3", http.StatusForbidden)
@@ -98,8 +98,8 @@ func (suite *AccessControlSuite) Test_Whitelist() {
9898
{"whitelist", " patterns/ips2"},
9999
}
100100

101-
suite.NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
102-
suite.NoError(suite.test.Apply("config/patternfile-a.yml", "", nil))
101+
suite.Require().NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
102+
suite.Require().NoError(suite.test.Apply("config/patternfile-a.yml", "", nil))
103103

104104
suite.eventuallyReturns("192.169.0.3", http.StatusOK)
105105
suite.eventuallyReturns("192.168.2.3", http.StatusForbidden)
@@ -113,8 +113,8 @@ func (suite *AccessControlSuite) Test_Whitelist() {
113113
{"allow-list", " patterns/ips"},
114114
}
115115

116-
suite.NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
117-
suite.NoError(suite.test.Apply("config/patternfile-a.yml", "", nil))
116+
suite.Require().NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
117+
suite.Require().NoError(suite.test.Apply("config/patternfile-a.yml", "", nil))
118118

119119
suite.eventuallyReturns("192.168.0.3", http.StatusOK)
120120
suite.eventuallyReturns("192.168.2.3", http.StatusForbidden)
@@ -129,7 +129,7 @@ func (suite *AccessControlSuite) Test_Blacklist() {
129129
{"deny-list", " 192.168.2.0/24"},
130130
}
131131

132-
suite.NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
132+
suite.Require().NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
133133

134134
suite.eventuallyReturns("192.168.2.3", http.StatusForbidden)
135135
suite.eventuallyReturns("192.168.5.3", http.StatusOK)
@@ -142,7 +142,7 @@ func (suite *AccessControlSuite) Test_Blacklist() {
142142
{"blacklist", "192.168.4.0/24"},
143143
}
144144

145-
suite.NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
145+
suite.Require().NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
146146

147147
suite.eventuallyReturns("192.168.4.3", http.StatusForbidden)
148148
suite.eventuallyReturns("192.168.5.3", http.StatusOK)
@@ -156,7 +156,7 @@ func (suite *AccessControlSuite) Test_Blacklist() {
156156
{"deny-list", "192.168.5.0/24"},
157157
}
158158

159-
suite.NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
159+
suite.Require().NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
160160

161161
suite.eventuallyReturns("192.168.5.3", http.StatusForbidden)
162162
suite.eventuallyReturns("192.168.4.3", http.StatusOK)
@@ -169,8 +169,8 @@ func (suite *AccessControlSuite) Test_Blacklist() {
169169
{"deny-list", "patterns/ips"},
170170
}
171171

172-
suite.NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
173-
suite.NoError(suite.test.Apply("config/patternfile-a.yml", "", nil))
172+
suite.Require().NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
173+
suite.Require().NoError(suite.test.Apply("config/patternfile-a.yml", "", nil))
174174

175175
suite.eventuallyReturns("192.168.0.3", http.StatusForbidden)
176176
suite.eventuallyReturns("192.168.2.3", http.StatusOK)
@@ -183,8 +183,8 @@ func (suite *AccessControlSuite) Test_Blacklist() {
183183
{"blacklist", " patterns/ips2"},
184184
}
185185

186-
suite.NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
187-
suite.NoError(suite.test.Apply("config/patternfile-a.yml", "", nil))
186+
suite.Require().NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
187+
suite.Require().NoError(suite.test.Apply("config/patternfile-a.yml", "", nil))
188188

189189
suite.eventuallyReturns("192.169.0.3", http.StatusForbidden)
190190
suite.eventuallyReturns("192.168.2.3", http.StatusOK)
@@ -197,8 +197,8 @@ func (suite *AccessControlSuite) Test_Blacklist() {
197197
{"deny-list", "patterns/ips"},
198198
}
199199

200-
suite.NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
201-
suite.NoError(suite.test.Apply("config/patternfile-a.yml", "", nil))
200+
suite.Require().NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
201+
suite.Require().NoError(suite.test.Apply("config/patternfile-a.yml", "", nil))
202202

203203
suite.eventuallyReturns("192.168.0.3", http.StatusForbidden)
204204
suite.eventuallyReturns("192.169.2.3", http.StatusOK)

deploy/tests/e2e/access-control/suite_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ type tmplData struct {
3939
func (suite *AccessControlSuite) SetupSuite() {
4040
var err error
4141
suite.test, err = e2e.NewTest()
42-
suite.NoError(err)
42+
suite.Require().NoError(err)
4343
suite.tmplData = tmplData{Host: suite.test.GetNS() + ".test"}
4444
suite.client, err = e2e.NewHTTPClient(suite.tmplData.Host)
45-
suite.NoError(err)
45+
suite.Require().NoError(err)
4646

47-
suite.NoError(suite.test.Apply("config/patternfile-empty.yml", "", nil))
47+
suite.Require().NoError(suite.test.Apply("config/patternfile-empty.yml", "", nil))
4848
}
4949

5050
func (suite *AccessControlSuite) TearDownSuite() {

deploy/tests/e2e/admin-port/suite_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ type tmplData struct {
3838
func (suite *AdminPortSuite) SetupSuite() {
3939
var err error
4040
suite.test, err = e2e.NewTest()
41-
suite.NoError(err)
41+
suite.Require().NoError(err)
4242
suite.tmplData = tmplData{Host: suite.test.GetNS() + ".test"}
4343
suite.client, err = e2e.NewHTTPClient(suite.tmplData.Host)
44-
suite.NoError(err)
44+
suite.Require().NoError(err)
4545
}
4646

4747
func (suite *AdminPortSuite) TearDownSuite() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424

2525
func (suite *HTTPBasicAuthSuite) Test_BasicAuth() {
2626
suite.Run("Denied", func() {
27-
suite.NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
27+
suite.Require().NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
2828
suite.Require().Eventually(func() bool {
2929
res, cls, err := suite.client.Do()
3030
if res == nil {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ type tmplData struct {
3838
func (suite *HTTPBasicAuthSuite) SetupSuite() {
3939
var err error
4040
suite.test, err = e2e.NewTest()
41-
suite.NoError(err)
41+
suite.Require().NoError(err)
4242
suite.tmplData = tmplData{Host: suite.test.GetNS() + ".test"}
4343
suite.client, err = e2e.NewHTTPClient(suite.tmplData.Host)
44-
suite.NoError(err)
44+
suite.Require().NoError(err)
4545
}
4646

4747
func (suite *HTTPBasicAuthSuite) TearDownSuite() {

deploy/tests/e2e/canary-deployment/percentage_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func (suite *CanaryDeploymentSuite) Test_Response_Percentage() {
2828
for _, percentage := range []int{0, 25, 100} {
2929
suite.Run(fmt.Sprintf("%d", percentage), func() {
3030
suite.tmplData.StagingRouteACL = fmt.Sprintf("rand(100) lt %d", percentage)
31-
suite.NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
31+
suite.Require().NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
3232
suite.Eventually(func() bool {
3333
counter := 0
3434
for i := 0; i < 10; i++ {

deploy/tests/e2e/canary-deployment/suite_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ type tmplData struct {
4141
func (suite *CanaryDeploymentSuite) SetupSuite() {
4242
var err error
4343
suite.test, err = e2e.NewTest()
44-
suite.NoError(err)
44+
suite.Require().NoError(err)
4545
suite.tmplData = tmplData{
4646
Host: suite.test.GetNS() + ".test",
4747
StagingRouteACL: "rand(100) lt 0",
4848
}
4949
suite.client, err = e2e.NewHTTPClient(suite.tmplData.Host)
50-
suite.NoError(err)
50+
suite.Require().NoError(err)
5151
suite.Require().NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
5252
suite.Require().Eventually(func() bool {
5353
res, cls, err := suite.client.Do()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
)
2525

2626
func (suite *ConfigSnippetSuite) TestBackendCfgSnippet() {
27-
suite.NoError(suite.test.Apply("config/backend-cfg-snippet.yaml", suite.test.GetNS(), nil))
27+
suite.Require().NoError(suite.test.Apply("config/backend-cfg-snippet.yaml", suite.test.GetNS(), nil))
2828
suite.Eventually(func() bool {
2929
res, cls, err := suite.client.Do()
3030
if err != nil {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
)
2525

2626
func (suite *ConfigSnippetSuite) TestFrontendCfgSnippet() {
27-
suite.NoError(suite.test.Apply("config/configmap.yaml", "", nil))
27+
suite.Require().NoError(suite.test.Apply("config/configmap.yaml", "", nil))
2828
suite.Eventually(func() bool {
2929
res, cls, err := suite.client.Do()
3030
if err != nil {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ type tmplData struct {
3838
func (suite *ConfigSnippetSuite) SetupSuite() {
3939
var err error
4040
suite.test, err = e2e.NewTest()
41-
suite.NoError(err)
41+
suite.Require().NoError(err)
4242
suite.tmplData = tmplData{Host: suite.test.GetNS() + ".test"}
4343
suite.client, err = e2e.NewHTTPClient(suite.tmplData.Host)
44-
suite.NoError(err)
45-
suite.NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
44+
suite.Require().NoError(err)
45+
suite.Require().NoError(suite.test.Apply("config/deploy.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
4646
suite.Require().Eventually(func() bool {
4747
res, cls, err := suite.client.Do()
4848
if res == nil {

0 commit comments

Comments
 (0)