예제 #1
0
    def test_filesystem_rename(self):
        """
        Test renaming a filesystem.
        """
        pool_name = p_n()
        pool_path = make_test_pool(pool_name, DISKS[0:1])

        fs_name = fs_n()
        make_test_filesystem(pool_path, fs_name)

        fs_name_rename = fs_n()

        (_, return_code, _) = StratisDbus.fs_rename(fs_name, fs_name_rename)
        self.assertEqual(return_code, dbus.UInt16(0))
예제 #2
0
    def test_filesystem_snapshot(self):
        """
        Test snapshotting a filesystem.
        """
        pool_name = p_n()
        pool_path = make_test_pool(pool_name, DISKS[0:1])

        fs_name = fs_n()
        fs_path = make_test_filesystem(pool_path, fs_name)

        snapshot_name = fs_n()

        (_, return_code, _) = StratisDbus.fs_snapshot(pool_path, fs_path,
                                                      snapshot_name)
        self.assertEqual(return_code, dbus.UInt16(0))
예제 #3
0
    def test_filesystem_create_same_name(self):
        """
        Test creating a filesystem that already exists.
        """
        pool_name = p_n()
        pool_path = make_test_pool(pool_name, DISKS[0:1])

        fs_name = fs_n()
        make_test_filesystem(pool_path, fs_name)

        (_, return_code, _) = StratisDbus.fs_create(pool_path, fs_name)
        self.assertEqual(return_code, dbus.UInt16(0))
예제 #4
0
def make_test_filesystem(pool_name):
    """
    Create a test filesystem that will later get destroyed
    :param pool_name: Name of a test pool
    :return: Name of the created filesystem
    """
    filesystem_name = fs_n()
    (return_code, _, stderr) = exec_test_command(
        [STRATIS_CLI, "filesystem", "create", pool_name, filesystem_name])
    assert return_code == 0, "return_code: %s, stderr: %s" % (return_code,
                                                              stderr)
    return filesystem_name
예제 #5
0
    def test_filesystem_list_not_empty(self):
        """
        Test listing an existent filesystem.
        """
        pool_name = p_n()
        pool_path = make_test_pool(pool_name, DISKS[0:1])

        fs_name = fs_n()
        make_test_filesystem(pool_path, fs_name)

        result = StratisDbus.fs_list()
        self.assertIsInstance(result, dict)
        self.assertNotEqual(result, {})
예제 #6
0
    def test_filesystem_destroy(self):
        """
        Test destroying a filesystem.
        """
        pool_name = p_n()
        pool_path = make_test_pool(pool_name, DISKS[0:1])

        fs_name = fs_n()
        make_test_filesystem(pool_path, fs_name)

        (_, return_code, _) = StratisDbus.fs_destroy(pool_name, fs_name)
        self.assertEqual(return_code, dbus.UInt16(0))

        self.assertEqual(StratisDbus.fs_list(), {})
예제 #7
0
 def test_filesystem_create(self):
     """
     Test creating a filesystem.
     """
     filesystem_name = fs_n()
     self.unittest_command(
         [
             STRATIS_CLI,
             "filesystem",
             "create",
             make_test_pool(DISKS[0:1]),
             filesystem_name,
         ],
         0,
         True,
         True,
     )
예제 #8
0
 def test_filesystem_snapshot(self):
     """
     Test snapshotting a filesystem.
     """
     pool_name = make_test_pool(DISKS[0:1])
     filesystem_name = make_test_filesystem(pool_name)
     snapshot_name = fs_n()
     self.unittest_command(
         [
             STRATIS_CLI,
             "filesystem",
             "snapshot",
             pool_name,
             filesystem_name,
             snapshot_name,
         ],
         0,
         True,
         True,
     )
예제 #9
0
 def test_filesystem_rename(self):
     """
     Test renaming a filesystem to a new name.
     """
     pool_name = make_test_pool(DISKS[0:1])
     filesystem_name = make_test_filesystem(pool_name)
     fs_name_rename = fs_n()
     self.unittest_command(
         [
             STRATIS_CLI,
             "filesystem",
             "rename",
             pool_name,
             filesystem_name,
             fs_name_rename,
         ],
         0,
         True,
         True,
     )