Пример #1
0
 def test_update_kernelramdisk_id(self):
     """test update_kernelramdisk_id. Case: the image need to be updated.
     check again after the update"""
     r = ami.update_kernelramdisk_id(self.reg_image, self.master_image,
                                     self.dict_reg)
     self.assertTrue(r)
     # It's already updated, therefore now it should return False
     r = ami.update_kernelramdisk_id(self.reg_image, self.master_image,
                                     self.dict_reg)
     self.assertFalse(r)
     self.assertEquals(self.reg_image.user_properties['ramdisk_id'],
                       self.img_ramdisk.id)
     self.assertEquals(self.reg_image.user_properties['kernel_id'],
                       self.img_kernel.id)
 def test_update_kernelramdisk_id(self):
     """test update_kernelramdisk_id. Case: the image need to be updated.
     check again after the update"""
     r = ami.update_kernelramdisk_id(self.reg_image, self.master_image,
                                     self.dict_reg)
     self.assertTrue(r)
     # It's already updated, therefore now it should return False
     r = ami.update_kernelramdisk_id(self.reg_image, self.master_image,
                                     self.dict_reg)
     self.assertFalse(r)
     self.assertEquals(self.reg_image.user_properties['ramdisk_id'],
                       self.img_ramdisk.id)
     self.assertEquals(self.reg_image.user_properties['kernel_id'],
                       self.img_kernel.id)
Пример #3
0
 def test_update_kernelramdisk_id_nomaster(self):
     """There are no kernel_id nor ramdisk_properties in master, but there
     are in regional image"""
     del self.master_image.user_properties['kernel_id']
     del self.master_image.user_properties['ramdisk_id']
     r = ami.update_kernelramdisk_id(self.reg_image, self.master_image,
                                     self.dict_reg)
     self.assertTrue(r)
     self.assertNotIn('kernel_id', self.reg_image.user_properties)
     self.assertNotIn('ramdisk_id', self.reg_image.user_properties)
 def test_update_kernelramdisk_id_nomaster(self):
     """There are no kernel_id nor ramdisk_properties in master, but there
     are in regional image"""
     del self.master_image.user_properties['kernel_id']
     del self.master_image.user_properties['ramdisk_id']
     r = ami.update_kernelramdisk_id(self.reg_image, self.master_image,
                                     self.dict_reg)
     self.assertTrue(r)
     self.assertNotIn('kernel_id', self.reg_image.user_properties)
     self.assertNotIn('ramdisk_id', self.reg_image.user_properties)
Пример #5
0
 def test_update_kernelramdisk_id_noproperties(self):
     """There are no kernel_id nor ramdisk_properties in master/image.
     The code should return False and do nothing"""
     del self.reg_image.user_properties['kernel_id']
     del self.reg_image.user_properties['ramdisk_id']
     del self.master_image.user_properties['kernel_id']
     del self.master_image.user_properties['ramdisk_id']
     copy_image = copy.deepcopy(self.reg_image)
     r = ami.update_kernelramdisk_id(self.reg_image, self.master_image,
                                     self.dict_reg)
     self.assertFalse(r)
     self.assertEquals(copy_image, self.reg_image)
 def test_update_kernelramdisk_id_noproperties(self):
     """There are no kernel_id nor ramdisk_properties in master/image.
     The code should return False and do nothing"""
     del self.reg_image.user_properties['kernel_id']
     del self.reg_image.user_properties['ramdisk_id']
     del self.master_image.user_properties['kernel_id']
     del self.master_image.user_properties['ramdisk_id']
     copy_image = copy.deepcopy(self.reg_image)
     r = ami.update_kernelramdisk_id(self.reg_image, self.master_image,
                                     self.dict_reg)
     self.assertFalse(r)
     self.assertEquals(copy_image, self.reg_image)
Пример #7
0
 def test_update_ramdiskid_missing(self):
     """test with the ramdisk_id not found"""
     del self.dict_reg[self.img_ramdisk.name]
     r = ami.update_kernelramdisk_id(self.reg_image, self.master_image,
                                     self.dict_reg)
     self.assertTrue(r)
     self.assertEquals(self.reg_image.user_properties['ramdisk_id'],
                       '__' + self.master_image.user_properties[
                           'ramdisk_id'])
     self.assertEquals(self.reg_image.user_properties['kernel_id'],
                       self.img_kernel.id)
     # verify warning was printed
     logs = self.logbuffer.getvalue()
     self.assertEquals(len(logs.splitlines()), 1)
 def test_update_ramdiskid_missing(self):
     """test with the ramdisk_id not found"""
     del self.dict_reg[self.img_ramdisk.name]
     r = ami.update_kernelramdisk_id(self.reg_image, self.master_image,
                                     self.dict_reg)
     self.assertTrue(r)
     self.assertEquals(
         self.reg_image.user_properties['ramdisk_id'],
         '__' + self.master_image.user_properties['ramdisk_id'])
     self.assertEquals(self.reg_image.user_properties['kernel_id'],
                       self.img_kernel.id)
     # verify warning was printed
     logs = self.logbuffer.getvalue()
     self.assertEquals(len(logs.splitlines()), 1)
Пример #9
0
 def test_update_kernelramdisk_id_missing(self):
     """test with both the kernel_id and ramdisks not found"""
     del self.dict_reg[self.img_kernel.name]
     del self.dict_reg[self.img_ramdisk.name]
     r = ami.update_kernelramdisk_id(self.reg_image, self.master_image,
                                     self.dict_reg)
     self.assertTrue(r)
     self.assertEquals(self.reg_image.user_properties['kernel_id'],
                       '__' + self.master_image.user_properties[
                           'kernel_id'])
     self.assertEquals(self.reg_image.user_properties['ramdisk_id'],
                       '__' + self.master_image.user_properties[
                           'ramdisk_id'])
     # check that warnings were printed
     logs = self.logbuffer.getvalue()
     self.assertEquals(len(logs.splitlines()), 2)
 def test_update_kernelramdisk_id_missing(self):
     """test with both the kernel_id and ramdisks not found"""
     del self.dict_reg[self.img_kernel.name]
     del self.dict_reg[self.img_ramdisk.name]
     r = ami.update_kernelramdisk_id(self.reg_image, self.master_image,
                                     self.dict_reg)
     self.assertTrue(r)
     self.assertEquals(
         self.reg_image.user_properties['kernel_id'],
         '__' + self.master_image.user_properties['kernel_id'])
     self.assertEquals(
         self.reg_image.user_properties['ramdisk_id'],
         '__' + self.master_image.user_properties['ramdisk_id'])
     # check that warnings were printed
     logs = self.logbuffer.getvalue()
     self.assertEquals(len(logs.splitlines()), 2)