- Fix the test for setting file_storage_dir, which didn't check if the
  value was really set.
- Add tests for shared_file_storage_dir, which were missing completely.

Signed-off-by: Petr Pudlak <[email protected]>
---
 test/py/cmdlib/cluster_unittest.py | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/test/py/cmdlib/cluster_unittest.py 
b/test/py/cmdlib/cluster_unittest.py
index 7097ac8..5d4de36 100644
--- a/test/py/cmdlib/cluster_unittest.py
+++ b/test/py/cmdlib/cluster_unittest.py
@@ -487,6 +487,7 @@ class TestLUClusterSetParams(CmdlibTestCase):
   def testFileStorageDir(self):
     op = opcodes.OpClusterSetParams(file_storage_dir="/random/path")
     self.ExecOpCode(op)
+    self.assertEqual("/random/path", self.cluster.file_storage_dir)
 
   def testSetFileStorageDirToCurrentValue(self):
     op = opcodes.OpClusterSetParams(
@@ -511,6 +512,36 @@ class TestLUClusterSetParams(CmdlibTestCase):
     self.ExecOpCode(op)
     self.mcpu.assertLogContainsRegex("although file storage is not enabled")
 
+  def testSharedFileStorageDir(self):
+    op = opcodes.OpClusterSetParams(shared_file_storage_dir="/random/path")
+    self.ExecOpCode(op)
+    self.assertEqual("/random/path", self.cluster.shared_file_storage_dir)
+
+  def testSetSharedFileStorageDirToCurrentValue(self):
+    op = opcodes.OpClusterSetParams(shared_file_storage_dir="/random/path")
+    self.ExecOpCode(op)
+    op = opcodes.OpClusterSetParams(shared_file_storage_dir="/random/path")
+    self.ExecOpCode(op)
+    self.mcpu.assertLogContainsRegex("shared file storage dir already set to"
+                                     " value")
+
+  def testUnsetSharedFileStorageDirSharedFileStorageEnabled(self):
+    self.cfg.SetEnabledDiskTemplates([constants.DT_SHARED_FILE])
+    op = opcodes.OpClusterSetParams(shared_file_storage_dir='')
+    self.ExecOpCodeExpectOpPrereqError(op, "Unsetting the 'sharedfile' 
storage")
+
+  def testUnsetSharedFileStorageDirSharedFileStorageDisabled(self):
+    self.cfg.SetEnabledDiskTemplates([constants.DT_PLAIN])
+    op = opcodes.OpClusterSetParams(shared_file_storage_dir='')
+    self.ExecOpCode(op)
+
+  def testSetSharedFileStorageDirSharedFileStorageDisabled(self):
+    self.cfg.SetEnabledDiskTemplates([constants.DT_PLAIN])
+    op = opcodes.OpClusterSetParams(shared_file_storage_dir='/some/path/')
+    self.ExecOpCode(op)
+    self.mcpu.assertLogContainsRegex("although sharedfile storage is not"
+                                     " enabled")
+
   def testValidDrbdHelper(self):
     node1 = self.cfg.AddNewNode()
     node1.offline = True
-- 
2.2.0.rc0.207.ga3a616c

Reply via email to