Ejemplo n.º 1
0
 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))
Ejemplo n.º 2
0
 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))
Ejemplo n.º 3
0
 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))
Ejemplo n.º 4
0
 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))
Ejemplo n.º 5
0
 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))
Ejemplo n.º 6
0
 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))
Ejemplo n.º 7
0
 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))
Ejemplo n.º 8
0
 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))
Ejemplo n.º 9
0
 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))
Ejemplo n.º 10
0
 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)
Ejemplo n.º 11
0
 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)
Ejemplo n.º 12
0
 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)
Ejemplo n.º 13
0
 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)
Ejemplo n.º 14
0
 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)
Ejemplo n.º 15
0
 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))
Ejemplo n.º 16
0
 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))
Ejemplo n.º 17
0
 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)
Ejemplo n.º 18
0
 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))
Ejemplo n.º 19
0
 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)
Ejemplo n.º 20
0
 def testList(self):
     """
     Listing the devices should succeed.
     """
     command_line = self._MENU + [self._POOLNAME]
     all(run(command_line))
Ejemplo n.º 21
0
 def testStratisVersion(self):
     """
     Getting version should just succeed.
     """
     command_line = self._MENU + ['--version']
     all(run(command_line))
Ejemplo n.º 22
0
 def testList(self):
     """
     List should just succeed.
     """
     command_line = self._MENU
     all(run(command_line))
Ejemplo n.º 23
0
 def testCreate(self):
     """
     Create should succeed, assuming devices are not busy.
     """
     command_line = self._MENU + [self._POOLNAME] + self._cache_devices()
     all(run(command_line))
Ejemplo n.º 24
0
 def testList(self):
     """
     Listing the volumes in an empty pool should succeed.
     """
     command_line = self._MENU + [self._POOLNAME]
     all(run(command_line))
Ejemplo n.º 25
0
 def testExecution(self):
     """
     Destroy should succeed.
     """
     command_line = self._MENU + [self._POOLNAME]
     all(run(command_line))
Ejemplo n.º 26
0
 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))
Ejemplo n.º 27
0
 def testExecution(self):
     """
     The pool was just created, so must be destroyable.
     """
     command_line = self._MENU + [self._POOLNAME]
     all(run(command_line))