From: Dimitris Bliablias <[email protected]>

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 <[email protected]>
Signed-off-by: Petr Pudlak <[email protected]>
Reviewed-by: Petr Pudlak <[email protected]>
Signed-off-by: Lisa Velden <[email protected]>
---
 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 378fa98..33b6f8a 100755
--- a/test/py/ganeti.utils.storage_unittest.py
+++ b/test/py/ganeti.utils.storage_unittest.py
@@ -73,6 +73,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,
@@ -89,9 +96,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))
 
-- 
2.2.0.rc0.207.ga3a616c

Reply via email to