Add a fullstack test for the file system based bank

Change-Id: Iffc2e6a5702f761e3d9a5b5a2cdad88edc18b1d6
Implements: blueprint file-system-bank
This commit is contained in:
chenying 2017-03-22 16:24:31 +08:00
parent 85af00153a
commit c70e418365
4 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,12 @@
[provider]
name = OS Infra Provider with local file system bank
description = This provider uses local file system as the bank of karbor
id = 6659007d-6f66-4a0f-9cb4-17d6aded0bb9
plugin=karbor-volume-protection-plugin
plugin=karbor-image-protection-plugin
plugin=karbor-server-protection-plugin
bank=karbor-fs-bank-plugin
[file_system_bank_plugin]
file_system_bank_path=/opt/stack/karbor_fs_bank

View File

@ -153,6 +153,7 @@ class KarborBaseTest(base.BaseTestCase):
self._testcase_store = ObjectStore()
self.provider_id_noop = 'b766f37c-d011-4026-8228-28730d734a3f'
self.provider_id_os = 'cf56bd3e-97a7-4078-b6d5-f36246333fd9'
self.provider_id_fs_bank = '6659007d-6f66-4a0f-9cb4-17d6aded0bb9'
def store(self, obj, close_func=None):
return self._testcase_store.store(obj, close_func)

View File

@ -169,3 +169,22 @@ class RestoresTest(karbor_base.KarborBaseTest):
item.status)
self.assertEqual(1, len(item.resources_status))
self._store(item.resources_status)
def test_restore_resources_with_fs_bank(self):
volume = self.store(objects.Volume())
volume.create(1)
plan = self.store(objects.Plan())
plan.create(self.provider_id_fs_bank, [volume, ])
checkpoint = self.store(objects.Checkpoint())
checkpoint.create(self.provider_id_fs_bank, plan.id)
restore_target = self.get_restore_target(self.keystone_endpoint)
restore = self.store(objects.Restore())
restore.create(self.provider_id_fs_bank, checkpoint.id,
restore_target, self.parameters, self.restore_auth)
item = self.karbor_client.restores.get(restore.id)
self.assertEqual(constants.RESTORE_STATUS_SUCCESS,
item.status)
self.assertEqual(1, len(item.resources_status))
self._store(item.resources_status)

View File

@ -41,6 +41,7 @@ karbor.database.migration_backend =
sqlalchemy = oslo_db.sqlalchemy.migration
karbor.protections =
karbor-swift-bank-plugin = karbor.services.protection.bank_plugins.swift_bank_plugin:SwiftBankPlugin
karbor-fs-bank-plugin = karbor.services.protection.bank_plugins.file_system_bank_plugin:FileSystemBankPlugin
karbor-volume-protection-plugin = karbor.services.protection.protection_plugins.volume.cinder_protection_plugin:CinderBackupProtectionPlugin
karbor-image-protection-plugin = karbor.services.protection.protection_plugins.image.image_protection_plugin:GlanceProtectionPlugin
karbor-server-protection-plugin = karbor.services.protection.protection_plugins.server.nova_protection_plugin:NovaProtectionPlugin