def test_api_create_aws_ebs(self):
        pvname = "yopv"
        pvcname = "yopvc"
        volname = "yovolume"
        podname = "yopod"
        contname = "yocontainer"

        pvtype = "awsElasticBlockStore"
        pv = _utils.create_pv(name=pvname, type=pvtype)
        pv.volume_id = "vol-0e3056a2"
        pv.fs_type = "xfs"

        pvc = _utils.create_pvc(name=pvcname)

        vol = _utils.create_volume(name=volname, type='persistentVolumeClaim')
        vol.claim_name = pvcname

        container = _utils.create_container(name=contname, image="nginx:latest")
        volmount = _utils.create_volume_mount(name=volname, mount_path='/test-persistent')
        container.add_volume_mount(volmount)

        pod = _utils.create_pod(name=podname)
        pod.add_volume(vol)
        pod.add_container(container)

        if _utils.is_reachable(pvc.config):
            try:
                pv.create()
                pvc.create()
                pod.create()
                self.assertIsInstance(pv, K8sPersistentVolume)
                self.assertIsInstance(pvc, K8sPersistentVolumeClaim)
            except Exception as err:
                self.assertIsInstance(err, TimedOutException)
    def test_api_create_nfs(self):
        pvname = "yopv"
        pvcname = "yopvc"
        volname = "yovolume"
        podname = "yopod"
        contname = "yocontainer"

        pvtype = "nfs"
        pv = _utils.create_pv(name=pvname, type=pvtype)
        pv.nfs_server = "nfs.company.com"
        pv.nfs_path = "/fs1/test-nfs"

        pvc = _utils.create_pvc(name=pvcname)

        vol = _utils.create_volume(name=volname, type='persistentVolumeClaim')
        vol.claim_name = pvcname

        container = _utils.create_container(name=contname, image="nginx:latest")
        volmount = _utils.create_volume_mount(name=volname, mount_path='/test-persistent')
        container.add_volume_mount(volmount)

        pod = _utils.create_pod(name=podname)
        pod.add_volume(vol)
        pod.add_container(container)

        if _utils.is_reachable(pvc.config):
            try:
                pv.create()
                pvc.create()
                pod.create()
                self.assertIsInstance(pv, K8sPersistentVolume)
                self.assertIsInstance(pvc, K8sPersistentVolumeClaim)
            except Exception as err:
                self.assertIsInstance(err, TimedOutException)
    def test_api_create_gce_pd(self):
        pvname = "yopv"
        pvcname = "yopvc"
        volname = "yovolume"
        podname = "yopod"
        contname = "yocontainer"

        pvtype = "gcePersistentDisk"
        pv = _utils.create_pv(name=pvname, type=pvtype)
        pv.pd_name = "mnubo-disk1"
        pv.fs_type = "xfs"

        pvc = _utils.create_pvc(name=pvcname)

        vol = _utils.create_volume(name=volname, type="persistentVolumeClaim")
        vol.claim_name = pvcname

        container = _utils.create_container(name=contname, image="nginx:latest")
        volmount = _utils.create_volume_mount(name=volname, mount_path="/test-persistent")
        container.add_volume_mount(volmount)

        pod = _utils.create_pod(name=podname)
        pod.add_volume(vol)
        pod.add_container(container)

        if _utils.is_reachable(pvc.config):
            try:
                pv.create()
                pvc.create()
                pod.create()
                self.assertIsInstance(pv, K8sPersistentVolume)
                self.assertIsInstance(pvc, K8sPersistentVolumeClaim)
            except Exception as err:
                self.assertIsInstance(err, TimedOutException)