@@ -139,17 +139,7 @@ var _ = Describe("Test event message handling", func() {
139139 return plc .Status .Details [0 ].History [0 ].Message
140140 }, defaultTimeoutSeconds , 1 ).Should (Equal ("NonCompliant; Violation detected" ))
141141 By ("Checking if policy status is noncompliant" )
142- Eventually (func () interface {} {
143- managedPlc = utils .GetWithTimeout (
144- clientManagedDynamic ,
145- gvrPolicy ,
146- case6PolicyName ,
147- clusterNamespace ,
148- true ,
149- defaultTimeoutSeconds )
150-
151- return getCompliant (managedPlc )
152- }, defaultTimeoutSeconds , 1 ).Should (Equal ("NonCompliant" ))
142+ Eventually (checkCompliance (case6PolicyName ), defaultTimeoutSeconds , 1 ).Should (Equal ("NonCompliant" ))
153143 })
154144 It ("Should remove `(combined from similar events):` prefix but still compliant" , func () {
155145 By ("Generating an event in ns:" + clusterNamespace + " that contains `(combined from similar events):` prefix" )
@@ -201,17 +191,7 @@ var _ = Describe("Test event message handling", func() {
201191 return plc .Status .Details [0 ].History [0 ].Message
202192 }, defaultTimeoutSeconds , 1 ).Should (Equal ("Compliant; no violation detected" ))
203193 By ("Checking if policy status is compliant" )
204- Eventually (func () interface {} {
205- managedPlc = utils .GetWithTimeout (
206- clientManagedDynamic ,
207- gvrPolicy ,
208- case6PolicyName ,
209- clusterNamespace ,
210- true ,
211- defaultTimeoutSeconds )
212-
213- return getCompliant (managedPlc )
214- }, defaultTimeoutSeconds , 1 ).Should (Equal ("Compliant" ))
194+ Eventually (checkCompliance (case6PolicyName ), defaultTimeoutSeconds , 1 ).Should (Equal ("Compliant" ))
215195 })
216196 It ("Should handle violation msg with just NonCompliant" , func () {
217197 By ("Generating an event in ns:" + clusterNamespace + " that only contains `NonCompliant`" )
@@ -263,17 +243,7 @@ var _ = Describe("Test event message handling", func() {
263243 return plc .Status .Details [0 ].History [0 ].Message
264244 }, defaultTimeoutSeconds , 1 ).Should (Equal ("NonCompliant" ))
265245 By ("Checking if policy status is noncompliant" )
266- Eventually (func () interface {} {
267- managedPlc = utils .GetWithTimeout (
268- clientManagedDynamic ,
269- gvrPolicy ,
270- case6PolicyName ,
271- clusterNamespace ,
272- true ,
273- defaultTimeoutSeconds )
274-
275- return getCompliant (managedPlc )
276- }, defaultTimeoutSeconds , 1 ).Should (Equal ("NonCompliant" ))
246+ Eventually (checkCompliance (case6PolicyName ), defaultTimeoutSeconds , 1 ).Should (Equal ("NonCompliant" ))
277247 })
278248 It ("Should handle violation msg with just Compliant" , func () {
279249 By ("Generating an event in ns:" + clusterNamespace + " that only contains `Compliant`" )
@@ -325,16 +295,6 @@ var _ = Describe("Test event message handling", func() {
325295 return plc .Status .Details [0 ].History [0 ].Message
326296 }, defaultTimeoutSeconds , 1 ).Should (Equal ("Compliant" ))
327297 By ("Checking if policy status is compliant" )
328- Eventually (func () interface {} {
329- managedPlc = utils .GetWithTimeout (
330- clientManagedDynamic ,
331- gvrPolicy ,
332- case6PolicyName ,
333- clusterNamespace ,
334- true ,
335- defaultTimeoutSeconds )
336-
337- return getCompliant (managedPlc )
338- }, defaultTimeoutSeconds , 1 ).Should (Equal ("Compliant" ))
298+ Eventually (checkCompliance (case6PolicyName ), defaultTimeoutSeconds , 1 ).Should (Equal ("Compliant" ))
339299 })
340300})
0 commit comments