def setup_install_source_task_failure_test(self, mount_mock): """Test NFS source setup failure""" task = SetUpNFSSourceTask(mount_location, nfs_url) with self.assertRaises(PayloadSetupError): task.run() mount_mock.assert_called_once_with(nfs_address, mount_location, fstype="nfs", options="nolock")
def test_setup_install_source_task_mount_failure(self, mount_mock): """Test NFS source setup failure""" task = SetUpNFSSourceTask(DEVICE_MOUNT_LOCATION, ISO_MOUNT_LOCATION, NFS_URL) with pytest.raises(SourceSetupError): task.run() mount_mock.assert_called_once_with(NFS_ADDRESS, DEVICE_MOUNT_LOCATION, fstype="nfs", options="nolock")
def test_setup_install_source_task_success_options( self, mount_mock, find_and_mount_iso_image_mock): """Test NFS source setup handling nolock in options""" task = SetUpNFSSourceTask(DEVICE_MOUNT_LOCATION, ISO_MOUNT_LOCATION, "nfs:some-option,nolock:" + NFS_ADDRESS) task.run() mount_mock.assert_called_with(NFS_ADDRESS, DEVICE_MOUNT_LOCATION, fstype="nfs", options="some-option,nolock") find_and_mount_iso_image_mock.assert_called_once_with( DEVICE_MOUNT_LOCATION, ISO_MOUNT_LOCATION)
def setup_install_source_task_success_options_test( self, mount_mock, find_and_mount_iso_image_mock): """Test NFS source setup handling nolock in options""" task = SetUpNFSSourceTask(device_mount_location, iso_mount_location, "nfs:some-option,nolock:" + nfs_address) task.run() mount_mock.assert_called_with(nfs_address, device_mount_location, fstype="nfs", options="some-option,nolock") find_and_mount_iso_image_mock.assert_called_once_with( device_mount_location, iso_mount_location)
def set_up_with_tasks(self): """Set up the installation source for installation. :return: list of tasks required for the source setup :rtype: [Task] """ return [SetUpNFSSourceTask(self.mount_point, self._url)]
def setup_install_source_task_success_test(self, mount_mock): """Test NFS source setup success""" SetUpNFSSourceTask(mount_location, nfs_url).run() mount_mock.assert_called_once_with(nfs_address, mount_location, fstype="nfs", options="nolock")
def setup_install_source_task_success_options_test(self, mount_mock): """Test NFS source setup handling nolock in options""" SetUpNFSSourceTask(mount_location, "nfs:some-option,nolock:" + nfs_address).run() mount_mock.assert_called_with(nfs_address, mount_location, fstype="nfs", options="some-option,nolock")
def set_up_with_tasks(self): """Set up the installation source for installation. :return: list of tasks required for the source setup :rtype: [Task] """ task = SetUpNFSSourceTask(self._device_mount, self._iso_mount, self._url) task.succeeded_signal.connect( lambda: self._handle_setup_task_result(task)) return [task]
def test_setup_install_source_task_find_anything_failure( self, mount_mock, find_and_mount_iso_image_mock, verify_valid_repository_mock, unmount_mock): """Test NFS can't find anything to install from""" task = SetUpNFSSourceTask(DEVICE_MOUNT_LOCATION, ISO_MOUNT_LOCATION, NFS_URL) with pytest.raises(SourceSetupError): task.run() mount_mock.assert_called_once_with(NFS_ADDRESS, DEVICE_MOUNT_LOCATION, fstype="nfs", options="nolock") find_and_mount_iso_image_mock.assert_called_once_with( DEVICE_MOUNT_LOCATION, ISO_MOUNT_LOCATION) verify_valid_repository_mock.assert_called_once_with( DEVICE_MOUNT_LOCATION) unmount_mock.assert_called_once_with(DEVICE_MOUNT_LOCATION)
def setup_install_source_task_find_anything_failure_test( self, mount_mock, find_and_mount_iso_image_mock, verify_valid_installtree_mock, unmount_mock): """Test NFS can't find anything to install from""" task = SetUpNFSSourceTask(device_mount_location, iso_mount_location, nfs_url) with self.assertRaises(SourceSetupError): task.run() mount_mock.assert_called_once_with(nfs_address, device_mount_location, fstype="nfs", options="nolock") find_and_mount_iso_image_mock.assert_called_once_with( device_mount_location, iso_mount_location) verify_valid_installtree_mock.assert_called_once_with( device_mount_location) unmount_mock.assert_called_once_with(device_mount_location)
def _set_up_additional_repository(self, data): """Set up sources for the additional repository.""" # Check the validity of the repository. if not data.url: msg = "The '{}' repository has no mirror, baseurl or metalink set." raise SourceSetupError(msg.format(data.name)) from None # Set up the NFS source with a substituted URL. elif data.url.startswith("nfs://"): device_mount = self._create_mount_point(constants.MOUNT_DIR, data.name + "-nfs-device") iso_mount = self._create_mount_point(constants.MOUNT_DIR, data.name + "-nfs-iso") task = SetUpNFSSourceTask(device_mount=device_mount, iso_mount=iso_mount, url=self._dnf_manager.substitute( data.url)) mount_point = task.run() data.url = "file://" + mount_point # Set up the HDD source. elif data.url.startswith("hd:"): device_mount = self._create_mount_point(ISO_DIR + "-" + data.name + "-hdd-device") iso_mount = self._create_mount_point(INSTALL_TREE + "-" + data.name + "-hdd-iso") partition, directory = parse_hdd_url(data.url) task = SetUpHardDriveSourceTask( device_mount=device_mount, iso_mount=iso_mount, partition=partition, directory=directory, ) result = task.run() data.url = "file://" + result.install_tree_path
def _create_setup_task(url=NFS_URL): return SetUpNFSSourceTask(DEVICE_MOUNT_LOCATION, ISO_MOUNT_LOCATION, url)
def test_setup_install_source_task_name(self): """Test NFS Source setup installation source task name.""" task = SetUpNFSSourceTask(DEVICE_MOUNT_LOCATION, ISO_MOUNT_LOCATION, NFS_URL) assert task.name == "Set up NFS installation source"
def setup_install_source_task_name_test(self): """Test NFS Source setup installation source task name.""" task = SetUpNFSSourceTask(mount_location, nfs_url) self.assertEqual(task.name, "Set up NFS installation source")
def _create_setup_task(): return SetUpNFSSourceTask(device_mount_location, iso_mount_location, nfs_url)
def setup_install_source_task_name_test(self): """Test NFS Source setup installation source task name.""" task = SetUpNFSSourceTask(DEVICE_MOUNT_LOCATION, ISO_MOUNT_LOCATION, NFS_URL) self.assertEqual(task.name, "Set up NFS installation source")