Пример #1
0
    def test_clone_from_template_error_handling(self):
        """
        Test clone from template - error during create
        """
        StorageDriverModule.use_bad_client()
        vdisk_1_1, pmachine = self._prepare()

        self.assertRaises(RuntimeError, VDiskController.create_from_template, vdisk_1_1.guid, 'vmachine_2', 'vdisk_1_1-clone', pmachine.guid)

        clones = VDiskList.get_vdisk_by_name('vdisk_1_1-clone')
        self.assertIsNone(clones, 'Clone not deleted after exception')
Пример #2
0
    def test_clone_from_template_error_handling(self):
        """
        Test clone from template - error during create
        """
        StorageDriverModule.use_bad_client()
        vdisk_1_1, pmachine = self._prepare()

        self.assertRaises(RuntimeError, VDiskController.create_from_template,
                          vdisk_1_1.guid, 'vmachine_2', 'vdisk_1_1-clone',
                          pmachine.guid)

        clones = VDiskList.get_vdisk_by_name('vdisk_1_1-clone')
        self.assertIsNone(clones, 'Clone not deleted after exception')
Пример #3
0
    def test_clone_from_template_happypath(self):
        """
        Test clone from template - happy path
        """
        StorageDriverModule.use_good_client()
        vdisk_1_1, pmachine = self._prepare()

        VDiskController.create_from_template(vdisk_1_1.guid, 'vmachine_2', 'vdisk_1_1-clone', pmachine.guid)

        vdisks = VDiskList.get_vdisk_by_name('vdisk_1_1')
        self.assertEqual(len(vdisks), 1, 'Vdisk not modeled')
        clones = VDiskList.get_vdisk_by_name('vdisk_1_1-clone')
        self.assertEqual(len(clones), 1, 'Clone not modeled')
Пример #4
0
    def test_clone_from_template_happypath(self):
        """
        Test clone from template - happy path
        """
        StorageDriverModule.use_good_client()
        vdisk_1_1, pmachine = self._prepare()

        VDiskController.create_from_template(vdisk_1_1.guid, 'vmachine_2',
                                             'vdisk_1_1-clone', pmachine.guid)

        vdisks = VDiskList.get_vdisk_by_name('vdisk_1_1')
        self.assertEqual(len(vdisks), 1, 'Vdisk not modeled')
        clones = VDiskList.get_vdisk_by_name('vdisk_1_1-clone')
        self.assertEqual(len(clones), 1, 'Clone not modeled')
Пример #5
0
    def test_clone_from_template_error_handling2(self):
        """
        Test clone from template - error during create, then error during delete
        """
        StorageDriverModule.use_bad_client()
        global VDisk
        def delete(self, *args, **kwargs):
            raise RuntimeError('DAL Error')
        _delete = VDisk.delete
        VDisk.delete = delete
        vdisk_1_1, pmachine = self._prepare()

        self.assertRaises(RuntimeError, VDiskController.create_from_template, vdisk_1_1.guid, 'vmachine_2', 'vdisk_1_1-clone', pmachine.guid)

        clones = VDiskList.get_vdisk_by_name('vdisk_1_1-clone')
        self.assertEqual(len(clones), 1, 'Clone deleted')
        VDisk.delete = _delete
Пример #6
0
    def test_clone_from_template_error_handling2(self):
        """
        Test clone from template - error during create, then error during delete
        """
        StorageDriverModule.use_bad_client()
        global VDisk

        def delete(self, *args, **kwargs):
            raise RuntimeError('DAL Error')

        _delete = VDisk.delete
        VDisk.delete = delete
        vdisk_1_1, pmachine = self._prepare()

        self.assertRaises(RuntimeError, VDiskController.create_from_template,
                          vdisk_1_1.guid, 'vmachine_2', 'vdisk_1_1-clone',
                          pmachine.guid)

        clones = VDiskList.get_vdisk_by_name('vdisk_1_1-clone')
        self.assertEqual(len(clones), 1, 'Clone deleted')
        VDisk.delete = _delete