@@ -16,8 +16,6 @@ package customresources
16
16
17
17
import (
18
18
"github.com/stretchr/testify/assert"
19
-
20
- "github.com/haproxytech/kubernetes-ingress/deploy/tests/e2e"
21
19
)
22
20
23
21
func (suite * CustomResourceSuite ) TestGlobalCR () {
@@ -28,21 +26,23 @@ func (suite *CustomResourceSuite) TestGlobalCR() {
28
26
t := suite .T ()
29
27
30
28
suite .Run ("Adding a global CR creates global and logTargets objects" , func () {
29
+ eventProcessedChan := make (chan struct {})
30
+ globalCREvt .EventProcessed = eventProcessedChan
31
31
eventChan <- globalCREvt
32
- suite .Require ().Eventually (func () bool {
33
- return assert .Len (t , globals , 1 , "Should find one and only one Global CR" ) ||
34
- assert .Len (t , logtrargets , 1 , "Should find one and only one LogTargets CR" ) ||
35
- assert .Containsf (t , globals , globalCREvt .Name , "Global CR of name '%s' not found" , globalCREvt .Name )
36
- }, e2e .WaitDuration , e2e .TickDuration )
32
+ <- eventProcessedChan
33
+ assert .Len (t , globals , 1 , "Should find one and only one Global CR" )
34
+ assert .Len (t , logtrargets , 1 , "Should find one and only one LogTargets CR" )
35
+ assert .Containsf (t , globals , globalCREvt .Name , "Global CR of name '%s' not found" , globalCREvt .Name )
37
36
})
38
37
39
38
suite .Run ("Deleting a global CR removes global and logTargets objects" , func () {
40
39
globalCREvt .Data = nil
40
+ eventProcessedChan := make (chan struct {})
41
+ globalCREvt .EventProcessed = eventProcessedChan
41
42
eventChan <- globalCREvt
42
- suite .Require ().Eventually (func () bool {
43
- return assert .Len (t , globals , 0 , "No Global CR should be present" ) ||
44
- assert .Len (t , logtrargets , 0 , "No LogTargets should be present" )
45
- }, e2e .WaitDuration , e2e .TickDuration )
43
+ <- eventProcessedChan
44
+ assert .Len (t , globals , 0 , "No Global CR should be present" )
45
+ assert .Len (t , logtrargets , 0 , "No LogTargets should be present" )
46
46
})
47
47
48
48
close (eventChan )
0 commit comments