def test_pool_rename(self): """ Test pool rename :return: """ pool_name = p_n() new_name = p_n() StratisCli.pool_create(pool_name, [DISKS[0]]) self.assertTrue(pool_name in StratisCli.pool_list()) StratisCli.pool_rename(pool_name, new_name) pl = StratisCli.pool_list() self.assertEqual(len(pl), 1) self.assertTrue(new_name in pl)
def test_no_list_listings(self): """ Test that commands that optionally take a list work both ways. :return: None """ pool_name = p_n() fs_name = fs_n() StratisCli.pool_create(pool_name, block_devices=DISKS) StratisCli.fs_create(pool_name, fs_name) self.assertEqual(StratisCli.pool_list(), StratisCli.pool_list(False)) self.assertEqual(StratisCli.fs_list(), StratisCli.fs_list(False)) self.assertEqual(StratisCli.blockdev_list(), StratisCli.blockdev_list(False))
def _clean_up(self): """ If an exception in raised in setUp, tearDown will not be called, thus we will place our cleanup in a method which is called after tearDown :return: None """ StratisCli.destroy_all() self.assertEqual(0, len(StratisCli.pool_list()))
def test_pool_create(self): """ Test pool create. :return: None """ pool_name = p_n() StratisCli.pool_create(pool_name, [DISKS[0]]) pools = StratisCli.pool_list() self.assertTrue(pool_name in pools) self.assertEqual(1, len(pools))
def test_pool_destroy(self): """ Test destroying a pool :return: None """ pool_name = p_n() StratisCli.pool_create(pool_name, [DISKS[0]]) StratisCli.pool_destroy(pool_name) pools = StratisCli.pool_list() self.assertFalse(pool_name in pools) self.assertEqual(0, len(pools))
def setUp(self): """ Ensure we are ready, which includes stratisd process is up and running and we have an empty configuration. If not we will attempt to make the configuration empty. :return: None """ self.addCleanup(self._clean_up) # The daemon should already be running, if not lets starts it and wait # a bit if process_exists('stratisd') is None: exec_command(["systemctl", "start", "stratisd"]) time.sleep(20) StratisCli.destroy_all() self.assertEqual(0, len(StratisCli.pool_list()))