From 42fdf9d0d79fb84796ad40ff6eb8c95e3206263e Mon Sep 17 00:00:00 2001 From: Dimitris Bliablias <bl.dimitris@gmail.com> Date: Mon, 14 Jul 2014 16:29:45 +0300 Subject: [PATCH] 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: Dimitris Bliablias <bl.dimitris@gmail.com> Signed-off-by: Petr Pudlak <pudlak@google.com> Reviewed-by: Petr Pudlak <pudlak@google.com> --- test/py/ganeti.utils.storage_unittest.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/py/ganeti.utils.storage_unittest.py b/test/py/ganeti.utils.storage_unittest.py index 64e627791..f71e1ca55 100755 --- a/test/py/ganeti.utils.storage_unittest.py +++ b/test/py/ganeti.utils.storage_unittest.py @@ -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)) -- GitLab