Commit b5f3cca8 authored by Petr Pudlak's avatar Petr Pudlak
Browse files

Fix tests for setting (shared) file storage directory



- 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: default avatarPetr Pudlak <pudlak@google.com>
Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
parent 5d7d31d1
......@@ -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
......
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