def prepare_system_for_installation_task_test(self, publisher): """Test Live OS is able to create a prepare installation task.""" self._prepare_and_use_source() task_path = self.live_os_interface.PreInstallWithTasks() check_task_creation_list(self, task_path, publisher, [PrepareSystemForInstallationTask])
def install_with_task_test(self, publisher): """Test Live OS install with tasks.""" self._prepare_and_use_source() task_path = self.live_os_interface.InstallWithTasks() check_task_creation_list(self, task_path, publisher, [InstallFromImageTask])
def install_with_tasks_test(self, publisher): """Test InstallWithTasks.""" task_classes = [ CreateGroupsTask, CreateUsersTask, SetRootPasswordTask, SetSshKeysTask, ConfigureRootPasswordSSHLoginTask ] task_paths = self.users_interface.InstallWithTasks() check_task_creation_list(self, task_paths, publisher, task_classes)
def post_install_with_tasks_test(self, publisher): """Test the PostInstallWithTasks method.""" self.assertEqual(self.payload_interface.PostInstallWithTasks(), []) payload = self.payload_module.create_payload(PayloadType.DNF) self.payload_module.activate_payload(payload) tasks_paths = self.payload_interface.PostInstallWithTasks() check_task_creation_list(self, tasks_paths, publisher, [CopyDriverDisksFilesTask])
def install_with_tasks_test(self, publisher): """Test the InstallWithTasks method.""" self.assertEqual(self.payload_interface.InstallWithTasks(), []) payload = self.payload_module.create_payload(PayloadType.DNF) self.payload_module.activate_payload(payload) tasks_paths = self.payload_interface.InstallWithTasks() check_task_creation_list(self, tasks_paths, publisher, [PrepareSystemForInstallationTask])
def tear_down_with_tasks_test(self, publisher): """Test the TeardownWithTasks method.""" self.assertEqual(self.payload_interface.TeardownWithTasks(), []) payload = self.payload_module.create_payload(PayloadType.DNF) self.payload_module.activate_payload(payload) source = self.payload_module.create_source(SourceType.CDROM) payload.set_sources([source]) publisher.reset_mock() task_paths = self.payload_interface.TeardownWithTasks() check_task_creation_list(self, task_paths, publisher, [TearDownSourcesTask])
def install_bootloader_with_tasks_test(self, publisher): """Test InstallBootloaderWithTasks.""" storage = Mock() version = "4.17.7-200.fc28.x86_64" self.bootloader_module.on_storage_changed(storage) task_classes = [ CreateRescueImagesTask, ConfigureBootloaderTask, InstallBootloaderTask, CreateBLSEntriesTask ] task_paths = self.bootloader_interface.InstallBootloaderWithTasks( PAYLOAD_TYPE_LIVE_IMAGE, [version]) check_task_creation_list(self, task_paths, publisher, task_classes)
def install_with_tasks_configured_test(self, publisher): """Test install tasks - module in configured state.""" self.timezone_interface.SetIsUTC(True) self.timezone_interface.SetTimezone("Asia/Tokyo") self.timezone_interface.SetNTPEnabled(False) # --nontp and --ntpservers are mutually exclusive in kicstart but # there is no such enforcement in the module so for testing this is ok self.timezone_interface.SetNTPServers([ "clock1.example.com", "clock2.example.com", ]) task_classes = [ ConfigureTimezoneTask, ConfigureNTPTask, ] task_paths = self.timezone_interface.InstallWithTasks() task_objs = check_task_creation_list(self, task_paths, publisher, task_classes) # ConfigureTimezoneTask obj = task_objs[0] self.assertEqual(obj.implementation._timezone, "Asia/Tokyo") self.assertEqual(obj.implementation._is_utc, True) # ConfigureNTPTask obj = task_objs[1] self.assertEqual(obj.implementation._ntp_enabled, False) self.assertEqual(obj.implementation._ntp_servers, [ "clock1.example.com", "clock2.example.com", ])
def install_with_tasks_test(self, publisher): """Test InstallWithTasks.""" task_classes = [BazInstallationTask] task_paths = self.interface.InstallWithTasks() task_proxies = check_task_creation_list(self, task_paths, publisher, task_classes) self.assertEqual(len(task_proxies), 1) self.assertEqual(task_proxies[0].implementation.name, "Install Baz")
def generate_initramfs_with_tasks_test(self, publisher): """Test GenerateInitramfsWithTasks.""" storage = Mock() version = "4.17.7-200.fc28.x86_64" self.bootloader_module.on_storage_changed(storage) task_classes = [ RecreateInitrdsTask, FixBTRFSBootloaderTask, FixZIPLBootloaderTask, ] task_paths = self.bootloader_interface.GenerateInitramfsWithTasks( PAYLOAD_TYPE_LIVE_IMAGE, [version]) check_task_creation_list(self, task_paths, publisher, task_classes)
def configure_with_tasks_test(self, publisher): """Test ConfigureWithTasks.""" task_classes = [BazConfigurationTask] task_paths = self.interface.ConfigureWithTasks() task_proxies = check_task_creation_list(self, task_paths, publisher, task_classes) self.assertEqual(len(task_proxies), 1) self.assertEqual(task_proxies[0].implementation.name, "Configure Baz")
def install_with_tasks_default_test(self, publisher): """Test install tasks - module in default state.""" task_classes = [ ConfigureTimezoneTask, ConfigureNTPTask, ] task_paths = self.timezone_interface.InstallWithTasks() task_objs = check_task_creation_list(self, task_paths, publisher, task_classes) # ConfigureTimezoneTask obj = task_objs[0] self.assertEqual(obj.implementation._timezone, "America/New_York") self.assertEqual(obj.implementation._is_utc, False) # ConfigureNTPTask obj = task_objs[1] self.assertEqual(obj.implementation._ntp_enabled, True) self.assertEqual(obj.implementation._ntp_servers, [])
def install_with_tasks_configured_test(self, publisher): """Test install tasks - module in configured state.""" realm = RealmData() realm.name = "domain.example.com" realm.discover_options = ["--client-software=sssd"] realm.join_options = ["--one-time-password=password"] realm.discovered = True authselect = ['select', 'sssd'] authconfig = ['--passalgo=sha512', '--useshadow'] fingerprint = True self.security_interface.SetRealm(RealmData.to_structure(realm)) self.security_interface.SetSELinux(SELINUX_PERMISSIVE) self.security_interface.SetAuthselect(authselect) self.security_interface.SetAuthconfig(authconfig) self.security_interface.SetFingerprintAuthEnabled(fingerprint) task_classes = [ ConfigureSELinuxTask, ConfigureFingerprintAuthTask, ConfigureAuthselectTask, ConfigureAuthconfigTask, ] task_paths = self.security_interface.InstallWithTasks() task_objs = check_task_creation_list(self, task_paths, publisher, task_classes) # ConfigureSELinuxTask obj = task_objs[0] self.assertEqual(obj.implementation._selinux_mode, SELinuxMode.PERMISSIVE) # ConfigureFingerprintAuthTask obj = task_objs[1] self.assertEqual(obj.implementation._fingerprint_auth_enabled, fingerprint) # ConfigureAuthselectTask obj = task_objs[2] self.assertEqual(obj.implementation._authselect_options, authselect) # ConfigureAuthconfigTask obj = task_objs[3] self.assertEqual(obj.implementation._authconfig_options, authconfig)
def install_with_tasks_configured_test(self, publisher): """Test install tasks - module in configured state.""" self.timezone_interface.SetIsUTC(True) self.timezone_interface.SetTimezone("Asia/Tokyo") self.timezone_interface.SetNTPEnabled(False) # --nontp and --ntpservers are mutually exclusive in kicstart but # there is no such enforcement in the module so for testing this is ok server = TimeSourceData() server.type = TIME_SOURCE_SERVER server.hostname = "clock1.example.com" server.options = ["iburst"] pool = TimeSourceData() pool.type = TIME_SOURCE_POOL pool.hostname = "clock2.example.com" self.timezone_interface.SetTimeSources( TimeSourceData.to_structure_list([server, pool])) task_classes = [ ConfigureTimezoneTask, ConfigureNTPTask, ] task_paths = self.timezone_interface.InstallWithTasks() task_objs = check_task_creation_list(self, task_paths, publisher, task_classes) # ConfigureTimezoneTask obj = task_objs[0] self.assertEqual(obj.implementation._timezone, "Asia/Tokyo") self.assertEqual(obj.implementation._is_utc, True) # ConfigureNTPTask obj = task_objs[1] self.assertEqual(obj.implementation._ntp_enabled, False) self.assertEqual(len(obj.implementation._ntp_servers), 2) self.assertTrue( compare_data(obj.implementation._ntp_servers[0], server)) self.assertTrue(compare_data(obj.implementation._ntp_servers[1], pool))
def install_with_tasks_default_test(self, publisher): """Test InstallWithTasks.""" task_classes = [ ConfigureSELinuxTask, ConfigureFingerprintAuthTask, ConfigureAuthselectTask, ConfigureAuthconfigTask, ] task_paths = self.security_interface.InstallWithTasks() task_objs = check_task_creation_list(self, task_paths, publisher, task_classes) # ConfigureSELinuxTask obj = task_objs[0] self.assertEqual(obj.implementation._selinux_mode, SELinuxMode.DEFAULT) # ConfigureFingerprintAuthTask obj = task_objs[1] self.assertEqual(obj.implementation._fingerprint_auth_enabled, False) # ConfigureAuthselectTask obj = task_objs[2] self.assertEqual(obj.implementation._authselect_options, []) # ConfigureAuthconfigTask obj = task_objs[3] self.assertEqual(obj.implementation._authconfig_options, [])
def install_with_task_from_image_test(self, publisher): """Test Live Image install with tasks from image.""" task_path = self.live_image_interface.InstallWithTasks() check_task_creation_list(self, task_path, publisher, [InstallFromImageTask])
def prepare_system_for_installation_task_test(self, publisher): """Test Live Image is able to create a prepare installation task.""" task_path = self.live_image_interface.PreInstallWithTasks() check_task_creation_list(self, task_path, publisher, [SetupInstallationSourceImageTask])