Skip to content

Commit

Permalink
Merge pull request #244 from hedrox/bug-rc-delete
Browse files Browse the repository at this point in the history
Fix replication controller pods delete in tests
  • Loading branch information
dudleyhunt86 committed Aug 15, 2021
2 parents 7a3fbb5 + 8768aa3 commit 6d52e48
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions dynamic/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,10 @@ def test_replication_controller_apis(self):
self.assertEqual(name, resp.metadata.name)
self.assertEqual(2, resp.spec.replicas)

resp = api.delete(
name=name, body={}, namespace='default')
api.delete(
name=name,
namespace='default',
propagation_policy='Background')

def test_configmap_apis(self):
client = DynamicClient(api_client.ApiClient(configuration=self.config))
Expand Down Expand Up @@ -357,29 +359,36 @@ def test_configmap_apis(self):
resp = api.delete(
name=name, body={}, namespace='default')

resp = api.get(namespace='default', pretty=True, label_selector="e2e-test=true")
resp = api.get(
namespace='default',
pretty=True,
label_selector="e2e-test=true")
self.assertEqual([], resp.items)

def test_node_apis(self):
client = DynamicClient(api_client.ApiClient(configuration=self.config))
api = client.resources.get(api_version='v1', kind='Node')

for item in api.get().items:
node = api.get(name=item.metadata.name)
self.assertTrue(len(dict(node.metadata.labels)) > 0)

# test_node_apis_partial_object_metadata lists all nodes in the cluster, but only retrieves object metadata

# test_node_apis_partial_object_metadata lists all nodes in the cluster,
# but only retrieves object metadata
def test_node_apis_partial_object_metadata(self):
client = DynamicClient(api_client.ApiClient(configuration=self.config))
api = client.resources.get(api_version='v1', kind='Node')

params = {'header_params': {'Accept': 'application/json;as=PartialObjectMetadataList;v=v1;g=meta.k8s.io'}}

params = {
'header_params': {
'Accept': 'application/json;as=PartialObjectMetadataList;v=v1;g=meta.k8s.io'}}
resp = api.get(**params)
self.assertEqual('PartialObjectMetadataList', resp.kind)
self.assertEqual('meta.k8s.io/v1', resp.apiVersion)

params = {'header_params': {'aCcePt': 'application/json;as=PartialObjectMetadataList;v=v1;g=meta.k8s.io'}}
params = {
'header_params': {
'aCcePt': 'application/json;as=PartialObjectMetadataList;v=v1;g=meta.k8s.io'}}
resp = api.get(**params)
self.assertEqual('PartialObjectMetadataList', resp.kind)
self.assertEqual('meta.k8s.io/v1', resp.apiVersion)

0 comments on commit 6d52e48

Please sign in to comment.