Deserialize Labels properly

Switch from 'object' to 'dict(str, str)' so that the labels
information is not lost.

Change-Id: I971ef230cda8b2ba5997ab71c622323956fcfbdd
This commit is contained in:
Davanum Srinivas 2016-09-07 14:56:28 -04:00
parent a2169399ae
commit 4f0b170a5f
4 changed files with 15 additions and 3 deletions

View File

@ -45,7 +45,7 @@ class V1ObjectMeta(object):
'creation_timestamp': 'str',
'deletion_timestamp': 'str',
'deletion_grace_period_seconds': 'int',
'labels': 'object',
'labels': 'dict(str, str)',
'annotations': 'object'
}

View File

@ -45,7 +45,7 @@ class V1ObjectMeta(object):
'creation_timestamp': 'str',
'deletion_timestamp': 'str',
'deletion_grace_period_seconds': 'int',
'labels': 'object',
'labels': 'dict(str, str)',
'annotations': 'object'
}

View File

@ -45,7 +45,7 @@ class V1ObjectMeta(object):
'creation_timestamp': 'str',
'deletion_timestamp': 'str',
'deletion_grace_period_seconds': 'int',
'labels': 'object',
'labels': 'dict(str, str)',
'annotations': 'object'
}

View File

@ -191,6 +191,18 @@ class TestK8sclient(base.TestCase):
name='test-configmap', body={}, namespace='default')
@unittest.skipUnless(
_is_k8s_running(), "Kubernetes is not available")
def test_node_apis(self):
client = api_client.ApiClient('http://127.0.0.1:8080/')
api = apiv_api.ApivApi(client)
for item in api.list_namespaced_node().items:
node = api.read_namespaced_node(name=item.metadata.name)
self.assertTrue(len(node.metadata.labels) > 0)
self.assertTrue(isinstance(node.metadata.labels, dict))
class TestK8sclientBeta(base.TestCase):
@unittest.skipUnless(
_is_k8s_running(), "Kubernetes is not available")