Beispiel #1
0
    def test_build_no_distro(self, mock_load_config_files, mock_get_builder):
        mock_load_config_files.return_value = [{
            'imagename': 'overcloud',
        }]

        mock_builder = mock.Mock()
        mock_get_builder.return_value = mock_builder

        build_manager = ImageBuildManager(['config/file'])
        self.assertRaises(ImageSpecificationException, build_manager.build)
def tripleo_build_images(config_files, output_directory, skip):

    try:
        manager = ImageBuildManager(config_files,
                                    output_directory=output_directory,
                                    skip=skip)
        manager.build()
    except Exception as e:
        return ('Fail', e)

    return ('Success', '')
Beispiel #3
0
    def test_build_with_skip(self, mock_load_config_files, mock_get_builder,
                             mock_os_path_exists):
        mock_load_config_files.return_value = fakes.create_disk_images().get(
            'disk_images')

        mock_builder = mock.Mock()
        mock_get_builder.return_value = mock_builder

        mock_os_path_exists.return_value = True

        build_manager = ImageBuildManager(['config/file'], skip=True)
        build_manager.build()

        self.assertEqual(1, mock_os_path_exists.call_count)
Beispiel #4
0
    def test_build(self, mock_load_config_files, mock_get_builder):
        mock_load_config_files.return_value = fakes.create_disk_images().get(
            'disk_images')

        mock_builder = mock.Mock()
        mock_get_builder.return_value = mock_builder

        build_manager = ImageBuildManager(['config/file'])
        build_manager.build()

        self.assertEqual(1, mock_load_config_files.call_count)

        mock_builder.build_image.assert_called_with(
            './overcloud', 'qcow2', 'some_awesome_os', 'amd64',
            ['image_element'], [], [],
            {'skip_base': False, 'docker_target': None, 'environment': {}})