@@ -318,8 +318,25 @@ def test_replication_controller_apis(self):
318
318
self .assertEqual (name , resp .metadata .name )
319
319
self .assertEqual (2 , resp .spec .replicas )
320
320
321
- resp = api .delete (
322
- name = name , body = {}, namespace = 'default' )
321
+ api .delete (
322
+ name = name ,
323
+ namespace = 'default' ,
324
+ propagation_policy = 'Background' )
325
+
326
+ pod_api = client .resources .get (api_version = 'v1' , kind = 'Pod' )
327
+ start = time .time ()
328
+ while time .time () - start < 60 :
329
+ pods = pod_api .get (
330
+ label_selector = 'name={}' .format (
331
+ resp .spec .selector .name ))
332
+ if not pods .items :
333
+ break
334
+ time .sleep (2 )
335
+
336
+ self .assertEqual (
337
+ [],
338
+ pods .items ,
339
+ 'ReplicationController pods were not deleted in the 60 sec interval' )
323
340
324
341
def test_configmap_apis (self ):
325
342
client = DynamicClient (api_client .ApiClient (configuration = self .config ))
@@ -357,29 +374,36 @@ def test_configmap_apis(self):
357
374
resp = api .delete (
358
375
name = name , body = {}, namespace = 'default' )
359
376
360
- resp = api .get (namespace = 'default' , pretty = True , label_selector = "e2e-test=true" )
377
+ resp = api .get (
378
+ namespace = 'default' ,
379
+ pretty = True ,
380
+ label_selector = "e2e-test=true" )
361
381
self .assertEqual ([], resp .items )
362
-
382
+
363
383
def test_node_apis (self ):
364
384
client = DynamicClient (api_client .ApiClient (configuration = self .config ))
365
385
api = client .resources .get (api_version = 'v1' , kind = 'Node' )
366
386
367
387
for item in api .get ().items :
368
388
node = api .get (name = item .metadata .name )
369
389
self .assertTrue (len (dict (node .metadata .labels )) > 0 )
370
-
371
- # test_node_apis_partial_object_metadata lists all nodes in the cluster, but only retrieves object metadata
390
+
391
+ # test_node_apis_partial_object_metadata lists all nodes in the cluster,
392
+ # but only retrieves object metadata
372
393
def test_node_apis_partial_object_metadata (self ):
373
394
client = DynamicClient (api_client .ApiClient (configuration = self .config ))
374
395
api = client .resources .get (api_version = 'v1' , kind = 'Node' )
375
-
376
- params = {'header_params' : {'Accept' : 'application/json;as=PartialObjectMetadataList;v=v1;g=meta.k8s.io' }}
396
+
397
+ params = {
398
+ 'header_params' : {
399
+ 'Accept' : 'application/json;as=PartialObjectMetadataList;v=v1;g=meta.k8s.io' }}
377
400
resp = api .get (** params )
378
401
self .assertEqual ('PartialObjectMetadataList' , resp .kind )
379
402
self .assertEqual ('meta.k8s.io/v1' , resp .apiVersion )
380
403
381
- params = {'header_params' : {'aCcePt' : 'application/json;as=PartialObjectMetadataList;v=v1;g=meta.k8s.io' }}
404
+ params = {
405
+ 'header_params' : {
406
+ 'aCcePt' : 'application/json;as=PartialObjectMetadataList;v=v1;g=meta.k8s.io' }}
382
407
resp = api .get (** params )
383
408
self .assertEqual ('PartialObjectMetadataList' , resp .kind )
384
409
self .assertEqual ('meta.k8s.io/v1' , resp .apiVersion )
385
-
0 commit comments