@@ -124,6 +124,8 @@ var _ = Describe("Handler Suite", func() {
124
124
var counter int32
125
125
126
126
BeforeEach (func () {
127
+ counter = 0
128
+
127
129
// Ensure the polling logic is excercised in tests
128
130
httpHandler = newMockHTTPHandler (func (rw http.ResponseWriter , req * http.Request ) {
129
131
if atomic .LoadInt32 (& counter ) == 4 {
@@ -135,15 +137,15 @@ var _ = Describe("Handler Suite", func() {
135
137
})
136
138
})
137
139
138
- JustBeforeEach (func () {
139
- // Ensure the polling logic is excercised in tests
140
- for atomic .LoadInt32 (& counter ) < 4 {
141
- continue
142
- }
143
- })
144
-
145
140
Context ("and the handler is stopped" , func () {
146
141
JustBeforeEach (func () {
142
+ // Ensure the polling logic is tested as well
143
+ for atomic .LoadInt32 (& counter ) < 4 {
144
+ // use 50ms since polling is set to 100ms
145
+ time .Sleep (50 * time .Millisecond )
146
+ continue
147
+ }
148
+
147
149
close (stop )
148
150
})
149
151
@@ -157,6 +159,15 @@ var _ = Describe("Handler Suite", func() {
157
159
})
158
160
159
161
Context ("and the instance termination notice is fulfilled" , func () {
162
+ JustBeforeEach (func () {
163
+ // Ensure the polling logic is tested as well
164
+ for atomic .LoadInt32 (& counter ) < 4 {
165
+ // use 50ms since polling is set to 100ms
166
+ time .Sleep (50 * time .Millisecond )
167
+ continue
168
+ }
169
+ })
170
+
160
171
It ("should mark the node for deletion" , func () {
161
172
Eventually (nodeMarkedForDeletion (testNode .Name )).Should (BeTrue ())
162
173
})
0 commit comments