@@ -200,8 +200,19 @@ var _ = ginkgo.Describe("[sig-node] ConfigMap", func() {
200
200
201
201
ctx , cancel := context .WithTimeout (context .Background (), 30 * time .Second )
202
202
defer cancel ()
203
- _ , err = framework .WatchUntilWithoutRetry (ctx , retryWatcher , func (watchEvent watch.Event ) (bool , error ) {
204
- return watchEvent .Type == watch .Added , nil
203
+ _ , err = framework .WatchUntilWithoutRetry (ctx , retryWatcher , func (event watch.Event ) (bool , error ) {
204
+ switch event .Type {
205
+ case watch .Added :
206
+ if cm , ok := event .Object .(* v1.ConfigMap ); ok {
207
+ found := cm .ObjectMeta .Name == testConfigMap .Name &&
208
+ cm .Labels ["test-configmap-static" ] == "true" &&
209
+ cm .Data ["valueName" ] == "value"
210
+ return found , nil
211
+ }
212
+ default :
213
+ framework .Logf ("observed event type %v" , event .Type )
214
+ }
215
+ return false , nil
205
216
})
206
217
framework .ExpectNoError (err , "failed to see a watch.Added event for the configmap we created" )
207
218
@@ -223,8 +234,20 @@ var _ = ginkgo.Describe("[sig-node] ConfigMap", func() {
223
234
ginkgo .By ("waiting for the ConfigMap to be modified" )
224
235
ctx , cancel = context .WithTimeout (context .Background (), 30 * time .Second )
225
236
defer cancel ()
226
- _ , err = framework .WatchUntilWithoutRetry (ctx , retryWatcher , func (watchEvent watch.Event ) (bool , error ) {
227
- return watchEvent .Type == watch .Modified , nil
237
+ _ , err = framework .WatchUntilWithoutRetry (ctx , retryWatcher , func (event watch.Event ) (bool , error ) {
238
+ switch event .Type {
239
+ case watch .Modified :
240
+ if cm , ok := event .Object .(* v1.ConfigMap ); ok {
241
+ found := cm .ObjectMeta .Name == testConfigMap .Name &&
242
+ cm .Labels ["test-configmap-static" ] == "true" &&
243
+ cm .Labels ["test-configmap" ] == "patched" &&
244
+ cm .Data ["valueName" ] == "value1"
245
+ return found , nil
246
+ }
247
+ default :
248
+ framework .Logf ("observed event type %v" , event .Type )
249
+ }
250
+ return false , nil
228
251
})
229
252
framework .ExpectNoError (err , "failed to see a watch.Modified event for the configmap we patched" )
230
253
@@ -260,8 +283,20 @@ var _ = ginkgo.Describe("[sig-node] ConfigMap", func() {
260
283
ginkgo .By ("waiting for the ConfigMap to be deleted" )
261
284
ctx , cancel = context .WithTimeout (context .Background (), 30 * time .Second )
262
285
defer cancel ()
263
- _ , err = framework .WatchUntilWithoutRetry (ctx , retryWatcher , func (watchEvent watch.Event ) (bool , error ) {
264
- return watchEvent .Type == watch .Deleted , nil
286
+ _ , err = framework .WatchUntilWithoutRetry (ctx , retryWatcher , func (event watch.Event ) (bool , error ) {
287
+ switch event .Type {
288
+ case watch .Deleted :
289
+ if cm , ok := event .Object .(* v1.ConfigMap ); ok {
290
+ found := cm .ObjectMeta .Name == testConfigMap .Name &&
291
+ cm .Labels ["test-configmap-static" ] == "true" &&
292
+ cm .Labels ["test-configmap" ] == "patched" &&
293
+ cm .Data ["valueName" ] == "value1"
294
+ return found , nil
295
+ }
296
+ default :
297
+ framework .Logf ("observed event type %v" , event .Type )
298
+ }
299
+ return false , nil
265
300
})
266
301
framework .ExpectNoError (err , "fasiled to observe a watch.Deleted event for the ConfigMap we deleted" )
267
302
})
0 commit comments