Commit 42fdf9d0 authored by Dimitris Bliablias's avatar Dimitris Bliablias Committed by Petr Pudlak

Add a unit test for the Gluster storage type

This patch, extends the 'ganeti.utils.storage_unittest.py' unit test
with a new test for the Gluster storage type. Also, the current unit
tests are updated accordingly to correspond to the latest changes.
Signed-off-by: default avatarDimitris Bliablias <bl.dimitris@gmail.com>
Signed-off-by: default avatarPetr Pudlak <pudlak@google.com>
Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
parent 604c8be2
......@@ -64,6 +64,13 @@ class TestGetStorageUnitForDiskTemplate(unittest.TestCase):
self.assertEqual(storage_type, constants.ST_SHARED_FILE)
self.assertEqual(storage_key, self._cluster.shared_file_storage_dir)
def testGetDefaultStorageUnitForDiskTemplateGluster(self):
(storage_type, storage_key) = \
storage._GetDefaultStorageUnitForDiskTemplate(self._cfg,
constants.DT_GLUSTER)
self.assertEqual(storage_type, constants.ST_GLUSTER)
self.assertEqual(storage_key, self._cluster.gluster_storage_dir)
def testGetDefaultStorageUnitForDiskTemplateDiskless(self):
(storage_type, storage_key) = \
storage._GetDefaultStorageUnitForDiskTemplate(self._cfg,
......@@ -80,9 +87,10 @@ class TestGetStorageUnits(unittest.TestCase):
self._cfg = mock.Mock()
def testGetStorageUnits(self):
disk_templates = constants.DTS_FILEBASED - frozenset(
storage.GetDiskTemplatesOfStorageTypes(constants.ST_SHARED_FILE)
)
sts_non_reporting = \
storage.GetDiskTemplatesOfStorageTypes(constants.ST_GLUSTER,
constants.ST_SHARED_FILE)
disk_templates = constants.DTS_FILEBASED - frozenset(sts_non_reporting)
storage_units = storage.GetStorageUnits(self._cfg, disk_templates)
self.assertEqual(len(storage_units), len(disk_templates))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment