Skip to content

Commit 17ea85e

Browse files
hdurand0710oktalz
authored andcommitted
TEST: make access control e2e tests more robust
1 parent 9e83018 commit 17ea85e

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ func (suite *AccessControlSuite) Test_Whitelist() {
4848

4949
suite.eventuallyReturns("192.168.2.3", http.StatusOK)
5050
suite.eventuallyReturns("192.168.5.3", http.StatusForbidden)
51+
suite.TearDownSubSuite()
5152
})
5253

5354
suite.Run("Inline deprecated annotation name", func() {
@@ -60,6 +61,7 @@ func (suite *AccessControlSuite) Test_Whitelist() {
6061

6162
suite.eventuallyReturns("192.168.4.3", http.StatusOK)
6263
suite.eventuallyReturns("192.168.5.3", http.StatusForbidden)
64+
suite.TearDownSubSuite()
6365
})
6466

6567
suite.Run("Inline: when new and deprecated annotation names are defined then only new name is considered", func() {
@@ -73,6 +75,7 @@ func (suite *AccessControlSuite) Test_Whitelist() {
7375

7476
suite.eventuallyReturns("192.168.5.3", http.StatusOK)
7577
suite.eventuallyReturns("192.168.4.3", http.StatusForbidden)
78+
suite.TearDownSubSuite()
7679
})
7780

7881
suite.Run("Patternfile", func() {
@@ -86,6 +89,7 @@ func (suite *AccessControlSuite) Test_Whitelist() {
8689

8790
suite.eventuallyReturns("192.168.0.3", http.StatusOK)
8891
suite.eventuallyReturns("192.168.2.3", http.StatusForbidden)
92+
suite.TearDownSubSuite()
8993
})
9094

9195
suite.Run("Patternfile deprecated annotation name", func() {
@@ -99,6 +103,7 @@ func (suite *AccessControlSuite) Test_Whitelist() {
99103

100104
suite.eventuallyReturns("192.169.0.3", http.StatusOK)
101105
suite.eventuallyReturns("192.168.2.3", http.StatusForbidden)
106+
suite.TearDownSubSuite()
102107
})
103108

104109
suite.Run("Patternfile: when new and deprecated annotation names are defined then only new name is considered", func() {
@@ -113,6 +118,7 @@ func (suite *AccessControlSuite) Test_Whitelist() {
113118

114119
suite.eventuallyReturns("192.168.0.3", http.StatusOK)
115120
suite.eventuallyReturns("192.168.2.3", http.StatusForbidden)
121+
suite.TearDownSubSuite()
116122
})
117123
}
118124

@@ -127,6 +133,7 @@ func (suite *AccessControlSuite) Test_Blacklist() {
127133

128134
suite.eventuallyReturns("192.168.2.3", http.StatusForbidden)
129135
suite.eventuallyReturns("192.168.5.3", http.StatusOK)
136+
suite.TearDownSubSuite()
130137
})
131138

132139
suite.Run("Inline deprecated annotation name", func() {
@@ -139,6 +146,7 @@ func (suite *AccessControlSuite) Test_Blacklist() {
139146

140147
suite.eventuallyReturns("192.168.4.3", http.StatusForbidden)
141148
suite.eventuallyReturns("192.168.5.3", http.StatusOK)
149+
suite.TearDownSubSuite()
142150
})
143151

144152
suite.Run("Inline: when new and deprecated annotation names are defined then only new name is considered", func() {
@@ -152,6 +160,7 @@ func (suite *AccessControlSuite) Test_Blacklist() {
152160

153161
suite.eventuallyReturns("192.168.5.3", http.StatusForbidden)
154162
suite.eventuallyReturns("192.168.4.3", http.StatusOK)
163+
suite.TearDownSubSuite()
155164
})
156165

157166
suite.Run("Patternfile", func() {
@@ -165,6 +174,7 @@ func (suite *AccessControlSuite) Test_Blacklist() {
165174

166175
suite.eventuallyReturns("192.168.0.3", http.StatusForbidden)
167176
suite.eventuallyReturns("192.168.2.3", http.StatusOK)
177+
suite.TearDownSubSuite()
168178
})
169179

170180
suite.Run("Patternfile deprecated annotation name", func() {
@@ -178,6 +188,7 @@ func (suite *AccessControlSuite) Test_Blacklist() {
178188

179189
suite.eventuallyReturns("192.169.0.3", http.StatusForbidden)
180190
suite.eventuallyReturns("192.168.2.3", http.StatusOK)
191+
suite.TearDownSubSuite()
181192
})
182193
suite.Run("Patternfile: when new and deprecated annotation names are defined then only new name is considered", func() {
183194
suite.tmplData.IngAnnotations = []struct{ Key, Value string }{
@@ -191,5 +202,6 @@ func (suite *AccessControlSuite) Test_Blacklist() {
191202

192203
suite.eventuallyReturns("192.168.0.3", http.StatusForbidden)
193204
suite.eventuallyReturns("192.169.2.3", http.StatusOK)
205+
suite.TearDownSubSuite()
194206
})
195207
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ func (suite *AccessControlSuite) TearDownSuite() {
5252
suite.test.TearDown()
5353
}
5454

55+
func (suite *AccessControlSuite) TearDownSubSuite() {
56+
suite.test.Apply("config/patternfile-empty.yml", "", nil)
57+
}
58+
5559
func TestAccessControlSuite(t *testing.T) {
5660
suite.Run(t, new(AccessControlSuite))
5761
}

0 commit comments

Comments
 (0)