Пример #1
0
    def test_revert_manage_existing_with_ft_failure(self):
        fake_db = fake_volume_api.FakeDb()
        fake_db.volume_destroy = mock.MagicMock()

        mock_failure = mock.Mock(spec=ft.Failure)
        task = manage_existing.EntryCreateTask(fake_db)
        task.revert(self.ctxt, mock_failure)

        # Check DB entry task is not destroyed
        fake_db.volume_destroy.assert_not_called()
Пример #2
0
    def test_revert_manage_existing(self):
        fake_db = fake_volume_api.FakeDb()
        fake_db.volume_destroy = mock.MagicMock()

        self.ctxt.elevated = mock.Mock()

        task = manage_existing.EntryCreateTask(fake_db)
        task.revert(self.ctxt, {'volume_id': fakes.VOLUME_ID})

        # Check DB entry task is destroyed
        fake_db.volume_destroy.assert_called_once_with(
            self.ctxt.elevated.return_value, fakes.VOLUME_ID)
Пример #3
0
    def test_create_db_entry_task_with_multiattach(self):

        fake_volume_type = fake_volume.fake_volume_type_obj(
            self.ctxt, extra_specs={'multiattach': '<is> True'})

        spec = {
            'name': 'name',
            'description': 'description',
            'host': 'host',
            'ref': 'ref',
            'volume_type': fake_volume_type,
            'metadata': {},
            'availability_zone': 'availability_zone',
            'bootable': 'bootable',
            'volume_type_id': fake_volume_type.id,
            'cluster_name': 'fake_cluster'
        }
        task = manage_existing.EntryCreateTask(fake_volume_api.FakeDb())

        result = task.execute(self.ctxt, **spec)
        self.assertTrue(result['volume_properties']['multiattach'])