Exemple #1
0
    def test_destroy_images(self):
        self._create_node()
        self.mox.StubOutWithMock(utils, 'unlink_without_raise')
        self.mox.StubOutWithMock(utils, 'rmtree_without_raise')

        utils.unlink_without_raise(pxe.get_image_file_path(self.instance))
        utils.rmtree_without_raise(pxe.get_image_dir_path(self.instance))
        self.mox.ReplayAll()

        self.driver.destroy_images(self.context, self.node, self.instance)
        self.mox.VerifyAll()
Exemple #2
0
    def test_destroy_images(self):
        self._create_node()
        self.mox.StubOutWithMock(utils, 'unlink_without_raise')
        self.mox.StubOutWithMock(utils, 'rmtree_without_raise')

        utils.unlink_without_raise(pxe.get_image_file_path(self.instance))
        utils.rmtree_without_raise(pxe.get_image_dir_path(self.instance))
        self.mox.ReplayAll()

        self.driver.destroy_images(self.context, self.node, self.instance)
        self.mox.VerifyAll()
Exemple #3
0
    def test_cache_image(self):
        self.mox.StubOutWithMock(os, 'makedirs')
        self.mox.StubOutWithMock(os.path, 'exists')
        os.makedirs(pxe.get_image_dir_path(self.instance)).\
                AndReturn(True)
        os.path.exists(pxe.get_image_file_path(self.instance)).\
                AndReturn(True)
        self.mox.ReplayAll()

        image_meta = utils.get_test_image_info(self.context, self.instance)
        self.driver._cache_image(self.context, self.instance, image_meta)
        self.mox.VerifyAll()
Exemple #4
0
    def test_cache_image(self):
        self.mox.StubOutWithMock(os, 'makedirs')
        self.mox.StubOutWithMock(os.path, 'exists')
        os.makedirs(pxe.get_image_dir_path(self.instance)).\
                AndReturn(True)
        os.path.exists(pxe.get_image_file_path(self.instance)).\
                AndReturn(True)
        self.mox.ReplayAll()

        image_meta = utils.get_test_image_info(
                self.context, self.instance)
        self.driver._cache_image(
                self.context, self.instance, image_meta)
        self.mox.VerifyAll()
Exemple #5
0
 def test_image_dir_path(self):
     self.assertEqual(
             pxe.get_image_dir_path(self.instance),
             os.path.join(CONF.instances_path, 'instance-00000001'))
Exemple #6
0
 def test_image_dir_path(self):
     self.assertEqual(
             pxe.get_image_dir_path(self.instance),
             os.path.join(CONF.instances_path, 'instance-00000001'))