def setUp(self): """ Start the stratisd daemon with the simulator. """ self._service = Service() self._service.setUp() time.sleep(1) command_line = ['create', self._POOLNAME] + self._pool_devices() all(run(command_line)) command_line = \ ['blockdev', 'cache', 'create', self._POOLNAME] + \ self._cache_devices() all(run(command_line))
def setUp(self): """ Start the stratisd daemon with the simulator. """ self._service = Service() self._service.setUp() time.sleep(1) command_line = \ ['pool', 'create'] + [self._POOLNAME] + \ [d.device_node for d in _device_list(_DEVICES, 1)] all(run(command_line)) command_line = self._MENU + [self._POOLNAME] + self._VOLNAMES all(run(command_line))
def testDestroy(self): """ Destruction of the volume must succeed since pool exists and at end volume is gone. """ command_line = self._MENU + [self._POOLNAME] + self._VOLNAMES all(run(command_line))
def testStratisTwoOptons(self): """ Exactly one option should be set, so this should fail. """ command_line = self._MENU + ['--log-level', '--version'] with self.assertRaises(SystemExit): all(run(command_line))
def testStratisNoOptions(self): """ Exactly one option should be set, so this should fail. """ command_line = self._MENU with self.assertRaises(SystemExit): all(run(command_line))
def testAdd(self): """ Adding devices that are already there should succeed if devices are unused by pool, but should fail otherwise. """ command_line = self._MENU + [self._POOLNAME] + self._DEVICES all(run(command_line))
def testExecution(self): """ This should fail since it has a volume. """ command_line = self._MENU + [self._POOLNAME] with self.assertRaises(StratisCliRuntimeError): all(run(command_line))
def testSnapshot(self): """ Snapshot of the volume could fail if not enough space in pool, should succeed if enough space in pool. """ command_line = \ self._MENU + [self._POOLNAME] + [self._ORIGIN] + [self._SNAP] all(run(command_line))
def testCreate(self): """ Create expects success unless devices are already occupied. """ command_line = \ self._MENU + \ [self._POOLNAME] + \ [d.device_node for d in _device_list(_DEVICES, 1)] all(run(command_line))
def testList(self): """ Listing the volume must fail since the pool does not exist. """ command_line = self._MENU + [self._POOLNAME] with self.assertRaises(StratisCliRuntimeError) as ctxt: all(run(command_line)) expected_error = StratisdErrorsGen.get_object().POOL_NOTFOUND self.assertEqual(ctxt.exception.rc, expected_error)
def testCreate(self): """ Create should fail, because there is already a cache. """ command_line = self._MENU + [self._POOLNAME] + self._other_devices() with self.assertRaises(StratisCliRuntimeError) as ctxt: all(run(command_line)) expected_error = StratisdErrorsGen.get_object().POOL_NOTFOUND self.assertEqual(ctxt.exception.rc, expected_error)
def testCreation(self): """ Creation of the volume must fail since pool is not specified. """ command_line = self._MENU + [self._POOLNAME] + self._VOLNAMES with self.assertRaises(StratisCliRuntimeError) as ctxt: all(run(command_line)) expected_error = StratisdErrorsGen.get_object().POOL_NOTFOUND self.assertEqual(ctxt.exception.rc, expected_error)
def testSnapshot(self): """ Snapshot of the volume must fail since there is no volume. """ command_line = \ self._MENU + [self._POOLNAME] + [self._ORIGIN] + [self._SNAP] with self.assertRaises(StratisCliRuntimeError) as ctxt: all(run(command_line)) expected_error = StratisdErrorsGen.get_object().VOLUME_NOTFOUND self.assertEqual(ctxt.exception.rc, expected_error)
def testCreation(self): """ Creation of this volume should fail, because there is an existing volume of the same name. """ command_line = self._MENU + [self._POOLNAME] + self._VOLNAMES with self.assertRaises(StratisCliRuntimeError) as ctxt: all(run(command_line)) expected_error = StratisdErrorsGen.get_object().LIST_FAILURE self.assertEqual(ctxt.exception.rc, expected_error)
def testCreate(self): """ Create should fail trying to create new pool with same name as previous. """ command_line = \ self._MENU + \ [self._POOLNAME] + \ [d.device_node for d in _device_list(_DEVICES, 1)] with self.assertRaises(StratisCliRuntimeError): all(run(command_line))
def setUp(self): """ Start the stratisd daemon with the simulator. """ self._service = Service() self._service.setUp() time.sleep(1) command_line = \ ['pool', 'create'] + [self._POOLNAME] + self._DEVICES all(run(command_line))
def testAdd(self): """ Adding the devices must fail since the pool does not exist. """ command_line = self._MENU + [self._POOLNAME] + \ [d.device_node for d in _device_list(_DEVICES, 1)] with self.assertRaises(StratisCliRuntimeError) as ctxt: all(run(command_line)) expected_error = StratisdErrorsGen.get_object().POOL_NOTFOUND self.assertEqual(ctxt.exception.rc, expected_error)
def testRedundancy(self): """ Parser error on all redundancy that is not 'none'. """ command_line = \ self._MENU + \ ['--redundancy', 'raid6'] + \ [self._POOLNAME] + \ [d.device_node for d in _device_list(_DEVICES, 1)] with self.assertRaises(SystemExit): all(run(command_line))
def testCreate(self): """ Create should fail because the pool does not exist. """ command_line = \ self._MENU + \ [self._POOLNAME] + \ [d.device_node for d in _device_list(_DEVICES, 1)] with self.assertRaises(StratisCliRuntimeError) as ctxt: all(run(command_line)) expected_error = StratisdErrorsGen.get_object().POOL_NOTFOUND self.assertEqual(ctxt.exception.rc, expected_error)
def testList(self): """ Listing the devices should succeed. """ command_line = self._MENU + [self._POOLNAME] all(run(command_line))
def testStratisVersion(self): """ Getting version should just succeed. """ command_line = self._MENU + ['--version'] all(run(command_line))
def testList(self): """ List should just succeed. """ command_line = self._MENU all(run(command_line))
def testCreate(self): """ Create should succeed, assuming devices are not busy. """ command_line = self._MENU + [self._POOLNAME] + self._cache_devices() all(run(command_line))
def testList(self): """ Listing the volumes in an empty pool should succeed. """ command_line = self._MENU + [self._POOLNAME] all(run(command_line))
def testExecution(self): """ Destroy should succeed. """ command_line = self._MENU + [self._POOLNAME] all(run(command_line))
def testCreation(self): """ Creation of the volume should succeed since pool is available. """ command_line = self._MENU + [self._POOLNAME] + self._VOLNAMES all(run(command_line))
def testExecution(self): """ The pool was just created, so must be destroyable. """ command_line = self._MENU + [self._POOLNAME] all(run(command_line))