def test_ok(self): pods = [{ 'spec': { 'volumes': [{ 'persistentVolumeClaim': { 'claimName': 'cm' } }] } }] oc = OC('cluster', 'server', 'token', local=True) owned_pvc_names = oc.get_pod_owned_pvc_names(pods) self.assertEqual(len(owned_pvc_names), 1) self.assertEqual(list(owned_pvc_names)[0], 'cm')
def test_ok(self): pods = [{ "spec": { "volumes": [{ "persistentVolumeClaim": { "claimName": "cm" } }] } }] oc = OC("cluster", "server", "token", local=True) owned_pvc_names = oc.get_pod_owned_pvc_names(pods) self.assertEqual(len(owned_pvc_names), 1) self.assertEqual(list(owned_pvc_names)[0], "cm")
def test_other_volumes(self): pods = [{'spec': {'volumes': [{'configMap': {'name': 'cm'}}]}}] oc = OC('cluster', 'server', 'token', local=True) owned_pvc_names = oc.get_pod_owned_pvc_names(pods) self.assertEqual(len(owned_pvc_names), 0)
def test_no_volumes(self): pods = [{'spec': {'volumes': []}}] oc = OC('cluster', 'server', 'token', local=True) owned_pvc_names = oc.get_pod_owned_pvc_names(pods) self.assertEqual(len(owned_pvc_names), 0)
def test_other_volumes(self): pods = [{"spec": {"volumes": [{"configMap": {"name": "cm"}}]}}] oc = OC("cluster", "server", "token", local=True) owned_pvc_names = oc.get_pod_owned_pvc_names(pods) self.assertEqual(len(owned_pvc_names), 0)
def test_no_volumes(self): pods = [{"spec": {"volumes": []}}] oc = OC("cluster", "server", "token", local=True) owned_pvc_names = oc.get_pod_owned_pvc_names(pods) self.assertEqual(len(owned_pvc_names), 0)