Ejemplo n.º 1
0
    def test_destroy_returns_none(self):
        dbg = mock.Mock()
        with util.TestFFSPath() as testffspath:
            testvolume = testffspath.create_test_volume()

            destroy_result = volume.Implementation().destroy(
                dbg, testffspath.get_uri(), testvolume)

            self.assertIsNone(destroy_result)
Ejemplo n.º 2
0
    def test_set_name_returns_none(self):
        dbg = mock.Mock()
        with util.TestFFSPath() as testffspath:
            testvolume = testffspath.create_test_volume()

            set_name_result = volume.Implementation().set_name(
                dbg, testffspath.get_uri(), testvolume, "testname")

            self.assertIsNone(set_name_result)
Ejemplo n.º 3
0
    def test_clone_returns_valid_dict(self, resume_datapath_in_pool,
                                      suspend_datapath_in_pool):
        dbg = mock.Mock()
        with util.TestFFSPath() as testffspath:
            testvolume = testffspath.create_test_volume()

            clone_result = volume.Implementation().clone(
                dbg, testffspath.get_uri(), testvolume)

        self.check_volume_stat_result(clone_result)
Ejemplo n.º 4
0
    def test_stat_returns_valid_dict(self):
        dbg = mock.Mock()
        with util.TestFFSPath() as testffspath:
            testvolume = testffspath.create_test_volume()

            stat_result = volume.Implementation().stat(dbg,
                                                       testffspath.get_uri(),
                                                       testvolume)

        self.check_volume_stat_result(stat_result)
Ejemplo n.º 5
0
    def test_create_returns_valid_dict(self):
        dbg = mock.Mock()
        name = "testname"
        description = "testdescription"
        size = 1337
        with util.TestFFSPath() as testffspath:

            create_result = volume.Implementation().create(
                dbg, testffspath.get_uri(), name, description, size)

        self.check_volume_stat_result(create_result)
Ejemplo n.º 6
0
    def test_sr_stat_returns_valid_dict(self):
        dbg = mock.Mock()
        with util.TestFFSPath() as testffspath:

            stat_result = sr.Implementation().stat(dbg, testffspath.get_uri())

        self.assertIsInstance(stat_result["sr"], str)
        self.assertIsInstance(stat_result["name"], str)
        self.assertIsInstance(stat_result["description"], str)
        self.assertIsInstance(stat_result["total_space"], int)
        self.assertIsInstance(stat_result["free_space"], int)
        self.assertIsInstance(stat_result["datasources"], list)
        self.assertIsInstance(stat_result["clustered"], bool)
        self.assertIsInstance(stat_result["health"][0], str)
        self.assertEqual(len(stat_result), 8)
Ejemplo n.º 7
0
    def test_sr_ls_returns_volumes(self):
        dbg = mock.Mock()
        with util.TestFFSPath() as testffspath:
            key = testffspath.create_test_volume()

            ls_result = sr.Implementation().ls(dbg, testffspath.get_uri())

        self.assertEqual(len(ls_result), 1)
        self.assertEqual(ls_result[0]['key'], key)
        self.assertEqual(ls_result[0]['uuid'],
                         testffspath.test_volume_data['uuid'])
        self.assertEqual(ls_result[0]['name'],
                         testffspath.test_volume_data['name'])
        self.assertEqual(ls_result[0]['description'],
                         testffspath.test_volume_data['description'])
        self.assertEqual(ls_result[0]['keys'],
                         testffspath.test_volume_data['keys'])
        self.assertIn("uri", ls_result[0])