def kernel_list_test(self): """Test get kernel list function.""" with TemporaryDirectory() as temp: boot_base = os.path.join(temp, "boot/vmlinuz-{}") efi_base = os.path.join(temp, "boot/efi/EFI/", conf.bootloader.efi_dir, "vmlinuz-{}") self._create_kernel_files(boot_base.format("boot-test1"), is_valid=True) self._create_kernel_files(boot_base.format("boot-test2.x86_64"), is_valid=True) self._create_kernel_files(boot_base.format("rescue-kernel.ppc64"), is_valid=False) self._create_kernel_files(efi_base.format("efi-test1"), is_valid=True) self._create_kernel_files(efi_base.format("efi-test2"), is_valid=True) self._create_kernel_files(efi_base.format("efi-test3.fc2000.i386"), is_valid=True) self._create_kernel_files( efi_base.format("efi-test-rescue-kernel"), is_valid=False) kernel_list = get_kernel_version_list(temp) self.assertListEqual(kernel_list, self._kernel_test_valid_list)
def update_kernel_version_list(self): """Update list of kernel versions.""" if url_target_is_tarfile(self._url): if not os.path.exists(self.image_path): raise SourceSetupError("Failed to find tarfile image") kernel_version_list = get_kernel_version_list_from_tar(self.image_path) else: kernel_version_list = get_kernel_version_list(INSTALL_TREE) self.set_kernel_version_list(kernel_version_list)
def kernel_list_empty_test(self): """Test empty get kernel list function.""" with TemporaryDirectory() as temp: result = get_kernel_version_list(temp) self.assertEqual(result, [])
def update_kernel_version_list(self): """Update list of kernel versions. Source have to be set-up first. """ self.set_kernel_version_list(get_kernel_version_list(INSTALL_TREE))