2016-01-05 08:27:20 +00:00
|
|
|
#!/usr/bin/env python2
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
|
2016-05-25 11:39:02 +00:00
|
|
|
try:
|
|
|
|
import unittest2 as unittest
|
|
|
|
except ImportError:
|
|
|
|
import unittest
|
2016-01-05 08:27:20 +00:00
|
|
|
import mock
|
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
|
|
|
|
|
|
|
from pungi.phases.image_build import ImageBuildPhase, CreateImageBuildThread
|
2016-03-22 11:18:31 +00:00
|
|
|
from tests.helpers import DummyCompose, PungiTestCase, boom
|
2016-01-11 16:14:51 +00:00
|
|
|
|
2016-01-05 08:27:20 +00:00
|
|
|
|
2016-02-11 14:15:36 +00:00
|
|
|
class TestImageBuildPhase(PungiTestCase):
|
2016-01-05 08:27:20 +00:00
|
|
|
|
2016-11-28 08:28:46 +00:00
|
|
|
def setUp(self):
|
|
|
|
super(TestImageBuildPhase, self).setUp()
|
|
|
|
self.maxDiff = None
|
|
|
|
|
2016-01-05 08:27:20 +00:00
|
|
|
@mock.patch('pungi.phases.image_build.ThreadPool')
|
|
|
|
def test_image_build(self, ThreadPool):
|
2016-02-22 14:58:34 +00:00
|
|
|
compose = DummyCompose(self.topdir, {
|
2016-01-05 08:27:20 +00:00
|
|
|
'image_build': {
|
|
|
|
'^Client|Server$': [
|
|
|
|
{
|
2016-02-11 12:22:03 +00:00
|
|
|
'image-build': {
|
|
|
|
'format': [('docker', 'tar.xz')],
|
|
|
|
'name': 'Fedora-Docker-Base',
|
|
|
|
'target': 'f24',
|
|
|
|
'version': 'Rawhide',
|
|
|
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
|
|
|
'kickstart': "fedora-docker-base.ks",
|
|
|
|
'distro': 'Fedora-20',
|
2016-08-22 14:08:25 +00:00
|
|
|
'disk_size': 3,
|
|
|
|
'failable': ['x86_64'],
|
2016-02-11 12:22:03 +00:00
|
|
|
}
|
2016-01-05 08:27:20 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
'koji_profile': 'koji',
|
|
|
|
})
|
|
|
|
|
2016-12-07 14:57:35 +00:00
|
|
|
self.assertValidConfig(compose.conf)
|
2016-08-22 14:08:25 +00:00
|
|
|
|
2016-01-05 08:27:20 +00:00
|
|
|
phase = ImageBuildPhase(compose)
|
|
|
|
|
|
|
|
phase.run()
|
|
|
|
|
|
|
|
# assert at least one thread was started
|
|
|
|
self.assertTrue(phase.pool.add.called)
|
|
|
|
client_args = {
|
|
|
|
"image_conf": {
|
2016-02-11 12:22:03 +00:00
|
|
|
'image-build': {
|
2016-02-11 14:15:36 +00:00
|
|
|
'install_tree': self.topdir + '/compose/Client/$arch/os',
|
2016-02-11 12:22:03 +00:00
|
|
|
'kickstart': 'fedora-docker-base.ks',
|
2017-10-30 12:23:49 +00:00
|
|
|
'format': ['docker'],
|
2016-02-11 14:15:36 +00:00
|
|
|
'repo': self.topdir + '/compose/Client/$arch/os',
|
2016-02-11 12:22:03 +00:00
|
|
|
'variant': compose.variants['Client'],
|
|
|
|
'target': 'f24',
|
|
|
|
'disk_size': 3,
|
|
|
|
'name': 'Fedora-Docker-Base',
|
2017-01-24 07:36:33 +00:00
|
|
|
'arches': ['amd64'],
|
2016-02-11 12:22:03 +00:00
|
|
|
'version': 'Rawhide',
|
|
|
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
|
|
|
'distro': 'Fedora-20',
|
2017-01-24 07:36:33 +00:00
|
|
|
'can_fail': ['x86_64'],
|
2016-02-11 12:22:03 +00:00
|
|
|
}
|
2016-01-05 08:27:20 +00:00
|
|
|
},
|
image-build: add arch name(s) in image config file name
Pungi write image config file with name of <format>-<name>.cfg, if there
are two or more image configs present for different arches under the same
variant and with same format & name, the config file can be overwritten,
and result in invalid image conf file.
Example:
image_build = {
'^Server$': [
{
'image-build': {
'format': [('qcow2', 'qcow2'),],
'name': 'fedora-guest-image',
'target': 'guest-fedora-26-image',
'version': '26',
'ksurl': "git://git.example.com/ks.git?fedora#HEAD",
'kickstart': "fedora-26-kvm.ks",
'ksversion': 'f26',
'distro': 'fedora-26',
'disk-size': '10',
'arches': ['x86_64'],
'repo': ["http://example.com/linux/fedora/26/Everything/x86_64/os", ]
}
},
{
'image-build': {
'format': [('qcow2', 'qcow2'),],
'name': 'fedora-guest-image',
'target': 'guest-fedora-26-image',
'version': '26',
'ksurl': "git://git.example.com/ks.git?fedora#HEAD",
'kickstart': "fedora-26-kvm.ks",
'ksversion': 'f26',
'distro': 'fedora-26',
'disk-size': '10',
'arches': ['ppc64le'],
}
},
],
}
In this case, config file "qcow2_guest-fedora-26-image.cfg" will be
created for both x86_64 and ppc64le under the same variant dir, and
there is a high chance it will be over-written while Pungi creating the
koji task. We can add arch name(s) in config filename to avoid that.
Signed-off-by: Qixiang Wan <qwan@redhat.com>
2017-08-31 08:10:52 +00:00
|
|
|
"conf_file": self.topdir + '/work/image-build/Client/docker_Fedora-Docker-Base_amd64.cfg',
|
2016-02-11 14:15:36 +00:00
|
|
|
"image_dir": self.topdir + '/compose/Client/%(arch)s/images',
|
|
|
|
"relative_image_dir": 'Client/%(arch)s/images',
|
2016-01-05 08:27:20 +00:00
|
|
|
"link_type": 'hardlink-or-copy',
|
2016-01-26 11:46:50 +00:00
|
|
|
"scratch": False,
|
2016-01-05 08:27:20 +00:00
|
|
|
}
|
|
|
|
server_args = {
|
|
|
|
"image_conf": {
|
2016-02-11 12:22:03 +00:00
|
|
|
'image-build': {
|
2016-02-11 14:15:36 +00:00
|
|
|
'install_tree': self.topdir + '/compose/Server/$arch/os',
|
2016-02-11 12:22:03 +00:00
|
|
|
'kickstart': 'fedora-docker-base.ks',
|
2017-10-30 12:23:49 +00:00
|
|
|
'format': ['docker'],
|
2016-02-11 14:15:36 +00:00
|
|
|
'repo': self.topdir + '/compose/Server/$arch/os',
|
2016-02-11 12:22:03 +00:00
|
|
|
'variant': compose.variants['Server'],
|
|
|
|
'target': 'f24',
|
|
|
|
'disk_size': 3,
|
|
|
|
'name': 'Fedora-Docker-Base',
|
2017-01-24 07:36:33 +00:00
|
|
|
'arches': ['amd64', 'x86_64'],
|
2016-02-11 12:22:03 +00:00
|
|
|
'version': 'Rawhide',
|
|
|
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
|
|
|
'distro': 'Fedora-20',
|
2017-01-24 07:36:33 +00:00
|
|
|
'can_fail': ['x86_64'],
|
2016-02-11 12:22:03 +00:00
|
|
|
}
|
2016-01-05 08:27:20 +00:00
|
|
|
},
|
image-build: add arch name(s) in image config file name
Pungi write image config file with name of <format>-<name>.cfg, if there
are two or more image configs present for different arches under the same
variant and with same format & name, the config file can be overwritten,
and result in invalid image conf file.
Example:
image_build = {
'^Server$': [
{
'image-build': {
'format': [('qcow2', 'qcow2'),],
'name': 'fedora-guest-image',
'target': 'guest-fedora-26-image',
'version': '26',
'ksurl': "git://git.example.com/ks.git?fedora#HEAD",
'kickstart': "fedora-26-kvm.ks",
'ksversion': 'f26',
'distro': 'fedora-26',
'disk-size': '10',
'arches': ['x86_64'],
'repo': ["http://example.com/linux/fedora/26/Everything/x86_64/os", ]
}
},
{
'image-build': {
'format': [('qcow2', 'qcow2'),],
'name': 'fedora-guest-image',
'target': 'guest-fedora-26-image',
'version': '26',
'ksurl': "git://git.example.com/ks.git?fedora#HEAD",
'kickstart': "fedora-26-kvm.ks",
'ksversion': 'f26',
'distro': 'fedora-26',
'disk-size': '10',
'arches': ['ppc64le'],
}
},
],
}
In this case, config file "qcow2_guest-fedora-26-image.cfg" will be
created for both x86_64 and ppc64le under the same variant dir, and
there is a high chance it will be over-written while Pungi creating the
koji task. We can add arch name(s) in config filename to avoid that.
Signed-off-by: Qixiang Wan <qwan@redhat.com>
2017-08-31 08:10:52 +00:00
|
|
|
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base_amd64-x86_64.cfg',
|
2016-02-11 14:15:36 +00:00
|
|
|
"image_dir": self.topdir + '/compose/Server/%(arch)s/images',
|
|
|
|
"relative_image_dir": 'Server/%(arch)s/images',
|
2016-01-05 08:27:20 +00:00
|
|
|
"link_type": 'hardlink-or-copy',
|
2016-01-26 11:46:50 +00:00
|
|
|
"scratch": False,
|
2016-01-05 08:27:20 +00:00
|
|
|
}
|
|
|
|
self.assertItemsEqual(phase.pool.queue_put.mock_calls,
|
|
|
|
[mock.call((compose, client_args)),
|
|
|
|
mock.call((compose, server_args))])
|
|
|
|
|
2016-04-14 12:23:42 +00:00
|
|
|
@mock.patch('pungi.phases.image_build.ThreadPool')
|
|
|
|
def test_image_build_phase_global_options(self, ThreadPool):
|
|
|
|
compose = DummyCompose(self.topdir, {
|
|
|
|
'image_build_ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
2017-04-07 13:33:43 +00:00
|
|
|
'image_build_release': '!RELEASE_FROM_LABEL_DATE_TYPE_RESPIN',
|
2016-04-14 12:23:42 +00:00
|
|
|
'image_build_target': 'f24',
|
|
|
|
'image_build_version': 'Rawhide',
|
|
|
|
'image_build': {
|
|
|
|
'^Server$': [
|
|
|
|
{
|
|
|
|
'image-build': {
|
2017-10-30 12:23:49 +00:00
|
|
|
'format': ['docker'],
|
2016-04-14 12:23:42 +00:00
|
|
|
'name': 'Fedora-Docker-Base',
|
|
|
|
'kickstart': "fedora-docker-base.ks",
|
|
|
|
'distro': 'Fedora-20',
|
|
|
|
'disk_size': 3
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
'koji_profile': 'koji',
|
|
|
|
})
|
|
|
|
|
2016-12-07 14:57:35 +00:00
|
|
|
self.assertValidConfig(compose.conf)
|
2016-08-22 14:08:25 +00:00
|
|
|
|
2016-04-14 12:23:42 +00:00
|
|
|
phase = ImageBuildPhase(compose)
|
|
|
|
|
|
|
|
phase.run()
|
|
|
|
|
|
|
|
# assert at least one thread was started
|
|
|
|
self.assertTrue(phase.pool.add.called)
|
|
|
|
server_args = {
|
|
|
|
"image_conf": {
|
|
|
|
'image-build': {
|
|
|
|
'install_tree': self.topdir + '/compose/Server/$arch/os',
|
|
|
|
'kickstart': 'fedora-docker-base.ks',
|
2017-10-30 12:23:49 +00:00
|
|
|
'format': ['docker'],
|
2016-04-14 12:23:42 +00:00
|
|
|
'repo': self.topdir + '/compose/Server/$arch/os',
|
|
|
|
'variant': compose.variants['Server'],
|
|
|
|
'target': 'f24',
|
|
|
|
'disk_size': 3,
|
|
|
|
'name': 'Fedora-Docker-Base',
|
2017-01-24 07:36:33 +00:00
|
|
|
'arches': ['amd64', 'x86_64'],
|
2016-04-14 12:23:42 +00:00
|
|
|
'version': 'Rawhide',
|
|
|
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
|
|
|
'distro': 'Fedora-20',
|
|
|
|
'release': '20151203.t.0',
|
|
|
|
}
|
|
|
|
},
|
image-build: add arch name(s) in image config file name
Pungi write image config file with name of <format>-<name>.cfg, if there
are two or more image configs present for different arches under the same
variant and with same format & name, the config file can be overwritten,
and result in invalid image conf file.
Example:
image_build = {
'^Server$': [
{
'image-build': {
'format': [('qcow2', 'qcow2'),],
'name': 'fedora-guest-image',
'target': 'guest-fedora-26-image',
'version': '26',
'ksurl': "git://git.example.com/ks.git?fedora#HEAD",
'kickstart': "fedora-26-kvm.ks",
'ksversion': 'f26',
'distro': 'fedora-26',
'disk-size': '10',
'arches': ['x86_64'],
'repo': ["http://example.com/linux/fedora/26/Everything/x86_64/os", ]
}
},
{
'image-build': {
'format': [('qcow2', 'qcow2'),],
'name': 'fedora-guest-image',
'target': 'guest-fedora-26-image',
'version': '26',
'ksurl': "git://git.example.com/ks.git?fedora#HEAD",
'kickstart': "fedora-26-kvm.ks",
'ksversion': 'f26',
'distro': 'fedora-26',
'disk-size': '10',
'arches': ['ppc64le'],
}
},
],
}
In this case, config file "qcow2_guest-fedora-26-image.cfg" will be
created for both x86_64 and ppc64le under the same variant dir, and
there is a high chance it will be over-written while Pungi creating the
koji task. We can add arch name(s) in config filename to avoid that.
Signed-off-by: Qixiang Wan <qwan@redhat.com>
2017-08-31 08:10:52 +00:00
|
|
|
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base_amd64-x86_64.cfg',
|
2016-04-14 12:23:42 +00:00
|
|
|
"image_dir": self.topdir + '/compose/Server/%(arch)s/images',
|
|
|
|
"relative_image_dir": 'Server/%(arch)s/images',
|
|
|
|
"link_type": 'hardlink-or-copy',
|
|
|
|
"scratch": False,
|
2016-08-30 07:51:36 +00:00
|
|
|
}
|
|
|
|
self.assertItemsEqual(phase.pool.queue_put.mock_calls,
|
|
|
|
[mock.call((compose, server_args))])
|
|
|
|
|
|
|
|
@mock.patch('pungi.phases.image_build.ThreadPool')
|
|
|
|
def test_image_build_phase_missing_version(self, ThreadPool):
|
|
|
|
compose = DummyCompose(self.topdir, {
|
|
|
|
'image_build_ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
2017-04-07 13:33:43 +00:00
|
|
|
'image_build_release': '!RELEASE_FROM_LABEL_DATE_TYPE_RESPIN',
|
2016-08-30 07:51:36 +00:00
|
|
|
'image_build_target': 'f24',
|
|
|
|
'image_build': {
|
|
|
|
'^Server$': [
|
|
|
|
{
|
|
|
|
'image-build': {
|
2017-10-30 12:23:49 +00:00
|
|
|
'format': 'docker',
|
2016-08-30 07:51:36 +00:00
|
|
|
'name': 'Fedora-Docker-Base',
|
|
|
|
'kickstart': "fedora-docker-base.ks",
|
|
|
|
'distro': 'Fedora-20',
|
|
|
|
'disk_size': 3
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
'koji_profile': 'koji',
|
|
|
|
})
|
|
|
|
|
|
|
|
phase = ImageBuildPhase(compose)
|
|
|
|
|
|
|
|
phase.run()
|
|
|
|
|
|
|
|
# assert at least one thread was started
|
|
|
|
self.assertTrue(phase.pool.add.called)
|
|
|
|
server_args = {
|
|
|
|
"image_conf": {
|
|
|
|
'image-build': {
|
|
|
|
'install_tree': self.topdir + '/compose/Server/$arch/os',
|
|
|
|
'kickstart': 'fedora-docker-base.ks',
|
2017-10-30 12:23:49 +00:00
|
|
|
'format': ['docker'],
|
2016-08-30 07:51:36 +00:00
|
|
|
'repo': self.topdir + '/compose/Server/$arch/os',
|
|
|
|
'variant': compose.variants['Server'],
|
|
|
|
'target': 'f24',
|
|
|
|
'disk_size': 3,
|
|
|
|
'name': 'Fedora-Docker-Base',
|
2017-01-24 07:36:33 +00:00
|
|
|
'arches': ['amd64', 'x86_64'],
|
2016-08-30 07:51:36 +00:00
|
|
|
'version': '25',
|
|
|
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
|
|
|
'distro': 'Fedora-20',
|
2016-04-14 12:23:42 +00:00
|
|
|
'release': '20151203.t.0',
|
|
|
|
}
|
|
|
|
},
|
image-build: add arch name(s) in image config file name
Pungi write image config file with name of <format>-<name>.cfg, if there
are two or more image configs present for different arches under the same
variant and with same format & name, the config file can be overwritten,
and result in invalid image conf file.
Example:
image_build = {
'^Server$': [
{
'image-build': {
'format': [('qcow2', 'qcow2'),],
'name': 'fedora-guest-image',
'target': 'guest-fedora-26-image',
'version': '26',
'ksurl': "git://git.example.com/ks.git?fedora#HEAD",
'kickstart': "fedora-26-kvm.ks",
'ksversion': 'f26',
'distro': 'fedora-26',
'disk-size': '10',
'arches': ['x86_64'],
'repo': ["http://example.com/linux/fedora/26/Everything/x86_64/os", ]
}
},
{
'image-build': {
'format': [('qcow2', 'qcow2'),],
'name': 'fedora-guest-image',
'target': 'guest-fedora-26-image',
'version': '26',
'ksurl': "git://git.example.com/ks.git?fedora#HEAD",
'kickstart': "fedora-26-kvm.ks",
'ksversion': 'f26',
'distro': 'fedora-26',
'disk-size': '10',
'arches': ['ppc64le'],
}
},
],
}
In this case, config file "qcow2_guest-fedora-26-image.cfg" will be
created for both x86_64 and ppc64le under the same variant dir, and
there is a high chance it will be over-written while Pungi creating the
koji task. We can add arch name(s) in config filename to avoid that.
Signed-off-by: Qixiang Wan <qwan@redhat.com>
2017-08-31 08:10:52 +00:00
|
|
|
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base_amd64-x86_64.cfg',
|
2016-04-14 12:23:42 +00:00
|
|
|
"image_dir": self.topdir + '/compose/Server/%(arch)s/images',
|
|
|
|
"relative_image_dir": 'Server/%(arch)s/images',
|
|
|
|
"link_type": 'hardlink-or-copy',
|
|
|
|
"scratch": False,
|
|
|
|
}
|
|
|
|
self.assertItemsEqual(phase.pool.queue_put.mock_calls,
|
|
|
|
[mock.call((compose, server_args))])
|
|
|
|
|
2016-01-05 08:27:20 +00:00
|
|
|
@mock.patch('pungi.phases.image_build.ThreadPool')
|
|
|
|
def test_image_build_filter_all_variants(self, ThreadPool):
|
2016-02-22 14:58:34 +00:00
|
|
|
compose = DummyCompose(self.topdir, {
|
2016-01-05 08:27:20 +00:00
|
|
|
'image_build': {
|
|
|
|
'^Client|Server$': [
|
|
|
|
{
|
2016-02-11 12:22:03 +00:00
|
|
|
'image-build': {
|
2017-10-30 12:23:49 +00:00
|
|
|
'format': ['docker'],
|
2016-02-11 12:22:03 +00:00
|
|
|
'name': 'Fedora-Docker-Base',
|
|
|
|
'target': 'f24',
|
|
|
|
'version': 'Rawhide',
|
|
|
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
|
|
|
'kickstart': "fedora-docker-base.ks",
|
|
|
|
'distro': 'Fedora-20',
|
|
|
|
'disk_size': 3,
|
|
|
|
'arches': ['non-existing'],
|
|
|
|
}
|
2016-01-05 08:27:20 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
'koji_profile': 'koji',
|
|
|
|
})
|
|
|
|
|
2016-12-07 14:57:35 +00:00
|
|
|
self.assertValidConfig(compose.conf)
|
2016-08-22 14:08:25 +00:00
|
|
|
|
2016-01-05 08:27:20 +00:00
|
|
|
phase = ImageBuildPhase(compose)
|
|
|
|
|
|
|
|
phase.run()
|
|
|
|
|
|
|
|
# assert at least one thread was started
|
|
|
|
self.assertFalse(phase.pool.add.called)
|
|
|
|
self.assertFalse(phase.pool.queue_put.called)
|
|
|
|
|
2016-01-08 12:37:09 +00:00
|
|
|
@mock.patch('pungi.phases.image_build.ThreadPool')
|
|
|
|
def test_image_build_set_install_tree(self, ThreadPool):
|
2016-02-22 14:58:34 +00:00
|
|
|
compose = DummyCompose(self.topdir, {
|
2016-01-08 12:37:09 +00:00
|
|
|
'image_build': {
|
|
|
|
'^Server$': [
|
|
|
|
{
|
2016-02-11 12:22:03 +00:00
|
|
|
'image-build': {
|
2017-10-30 12:23:49 +00:00
|
|
|
'format': ['docker'],
|
2016-02-11 12:22:03 +00:00
|
|
|
'name': 'Fedora-Docker-Base',
|
|
|
|
'target': 'f24',
|
|
|
|
'version': 'Rawhide',
|
|
|
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
|
|
|
'kickstart': "fedora-docker-base.ks",
|
|
|
|
'distro': 'Fedora-20',
|
|
|
|
'disk_size': 3,
|
|
|
|
'arches': ['x86_64'],
|
2016-11-09 09:20:55 +00:00
|
|
|
'install_tree_from': 'Server-optional',
|
2016-02-11 12:22:03 +00:00
|
|
|
}
|
2016-01-08 12:37:09 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
'koji_profile': 'koji',
|
|
|
|
})
|
2016-11-09 12:39:01 +00:00
|
|
|
compose.setup_optional()
|
2016-01-08 12:37:09 +00:00
|
|
|
|
2016-12-07 14:57:35 +00:00
|
|
|
self.assertValidConfig(compose.conf)
|
2016-08-22 14:08:25 +00:00
|
|
|
|
2016-01-08 12:37:09 +00:00
|
|
|
phase = ImageBuildPhase(compose)
|
|
|
|
|
|
|
|
phase.run()
|
|
|
|
|
|
|
|
# assert at least one thread was started
|
|
|
|
self.assertTrue(phase.pool.add.called)
|
|
|
|
|
|
|
|
self.assertTrue(phase.pool.queue_put.called_once)
|
|
|
|
args, kwargs = phase.pool.queue_put.call_args
|
|
|
|
self.assertEqual(args[0][0], compose)
|
|
|
|
self.assertDictEqual(args[0][1], {
|
|
|
|
"image_conf": {
|
2016-02-11 12:22:03 +00:00
|
|
|
'image-build': {
|
2016-11-09 09:20:55 +00:00
|
|
|
'install_tree': self.topdir + '/compose/Server-optional/$arch/os',
|
2016-02-11 12:22:03 +00:00
|
|
|
'kickstart': 'fedora-docker-base.ks',
|
2017-10-30 12:23:49 +00:00
|
|
|
'format': ['docker'],
|
2016-02-11 14:15:36 +00:00
|
|
|
'repo': self.topdir + '/compose/Server/$arch/os',
|
2016-02-11 12:22:03 +00:00
|
|
|
'variant': compose.variants['Server'],
|
|
|
|
'target': 'f24',
|
|
|
|
'disk_size': 3,
|
|
|
|
'name': 'Fedora-Docker-Base',
|
2017-01-24 07:36:33 +00:00
|
|
|
'arches': ['x86_64'],
|
2016-02-11 12:22:03 +00:00
|
|
|
'version': 'Rawhide',
|
|
|
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
|
|
|
'distro': 'Fedora-20',
|
|
|
|
}
|
2016-01-08 12:37:09 +00:00
|
|
|
},
|
image-build: add arch name(s) in image config file name
Pungi write image config file with name of <format>-<name>.cfg, if there
are two or more image configs present for different arches under the same
variant and with same format & name, the config file can be overwritten,
and result in invalid image conf file.
Example:
image_build = {
'^Server$': [
{
'image-build': {
'format': [('qcow2', 'qcow2'),],
'name': 'fedora-guest-image',
'target': 'guest-fedora-26-image',
'version': '26',
'ksurl': "git://git.example.com/ks.git?fedora#HEAD",
'kickstart': "fedora-26-kvm.ks",
'ksversion': 'f26',
'distro': 'fedora-26',
'disk-size': '10',
'arches': ['x86_64'],
'repo': ["http://example.com/linux/fedora/26/Everything/x86_64/os", ]
}
},
{
'image-build': {
'format': [('qcow2', 'qcow2'),],
'name': 'fedora-guest-image',
'target': 'guest-fedora-26-image',
'version': '26',
'ksurl': "git://git.example.com/ks.git?fedora#HEAD",
'kickstart': "fedora-26-kvm.ks",
'ksversion': 'f26',
'distro': 'fedora-26',
'disk-size': '10',
'arches': ['ppc64le'],
}
},
],
}
In this case, config file "qcow2_guest-fedora-26-image.cfg" will be
created for both x86_64 and ppc64le under the same variant dir, and
there is a high chance it will be over-written while Pungi creating the
koji task. We can add arch name(s) in config filename to avoid that.
Signed-off-by: Qixiang Wan <qwan@redhat.com>
2017-08-31 08:10:52 +00:00
|
|
|
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base_x86_64.cfg',
|
2016-02-11 14:15:36 +00:00
|
|
|
"image_dir": self.topdir + '/compose/Server/%(arch)s/images',
|
|
|
|
"relative_image_dir": 'Server/%(arch)s/images',
|
2016-01-11 08:03:04 +00:00
|
|
|
"link_type": 'hardlink-or-copy',
|
2016-01-26 11:46:50 +00:00
|
|
|
"scratch": False,
|
2016-01-11 08:03:04 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
@mock.patch('pungi.phases.image_build.ThreadPool')
|
|
|
|
def test_image_build_set_extra_repos(self, ThreadPool):
|
2016-02-22 14:58:34 +00:00
|
|
|
compose = DummyCompose(self.topdir, {
|
2016-01-11 08:03:04 +00:00
|
|
|
'image_build': {
|
|
|
|
'^Server$': [
|
|
|
|
{
|
2016-02-11 12:22:03 +00:00
|
|
|
'image-build': {
|
2017-10-30 12:23:49 +00:00
|
|
|
'format': ['docker'],
|
2016-02-11 12:22:03 +00:00
|
|
|
'name': 'Fedora-Docker-Base',
|
|
|
|
'target': 'f24',
|
|
|
|
'version': 'Rawhide',
|
|
|
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
|
|
|
'kickstart': "fedora-docker-base.ks",
|
|
|
|
'distro': 'Fedora-20',
|
|
|
|
'disk_size': 3,
|
|
|
|
'arches': ['x86_64'],
|
2016-11-09 09:20:55 +00:00
|
|
|
'repo_from': ['Everything', 'Server-optional'],
|
2016-02-11 12:22:03 +00:00
|
|
|
}
|
2016-01-11 08:03:04 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
'koji_profile': 'koji',
|
|
|
|
})
|
2016-11-09 12:39:01 +00:00
|
|
|
compose.setup_optional()
|
2016-01-11 08:03:04 +00:00
|
|
|
|
2016-12-07 14:57:35 +00:00
|
|
|
self.assertValidConfig(compose.conf)
|
2016-08-22 14:08:25 +00:00
|
|
|
|
2016-01-11 08:03:04 +00:00
|
|
|
phase = ImageBuildPhase(compose)
|
|
|
|
|
|
|
|
phase.run()
|
|
|
|
|
|
|
|
# assert at least one thread was started
|
|
|
|
self.assertTrue(phase.pool.add.called)
|
|
|
|
|
|
|
|
self.assertTrue(phase.pool.queue_put.called_once)
|
|
|
|
args, kwargs = phase.pool.queue_put.call_args
|
|
|
|
self.assertEqual(args[0][0], compose)
|
|
|
|
self.assertDictEqual(args[0][1], {
|
|
|
|
"image_conf": {
|
2016-02-11 12:22:03 +00:00
|
|
|
'image-build': {
|
2016-02-11 14:15:36 +00:00
|
|
|
'install_tree': self.topdir + '/compose/Server/$arch/os',
|
2016-02-11 12:22:03 +00:00
|
|
|
'kickstart': 'fedora-docker-base.ks',
|
2017-10-30 12:23:49 +00:00
|
|
|
'format': ['docker'],
|
2016-02-11 14:15:36 +00:00
|
|
|
'repo': ','.join([self.topdir + '/compose/Everything/$arch/os',
|
2016-11-09 09:20:55 +00:00
|
|
|
self.topdir + '/compose/Server-optional/$arch/os',
|
2016-02-11 14:15:36 +00:00
|
|
|
self.topdir + '/compose/Server/$arch/os']),
|
2016-02-11 12:22:03 +00:00
|
|
|
'variant': compose.variants['Server'],
|
|
|
|
'target': 'f24',
|
|
|
|
'disk_size': 3,
|
|
|
|
'name': 'Fedora-Docker-Base',
|
2017-01-24 07:36:33 +00:00
|
|
|
'arches': ['x86_64'],
|
2016-02-11 12:22:03 +00:00
|
|
|
'version': 'Rawhide',
|
|
|
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
|
|
|
'distro': 'Fedora-20',
|
|
|
|
}
|
2016-01-11 08:03:04 +00:00
|
|
|
},
|
image-build: add arch name(s) in image config file name
Pungi write image config file with name of <format>-<name>.cfg, if there
are two or more image configs present for different arches under the same
variant and with same format & name, the config file can be overwritten,
and result in invalid image conf file.
Example:
image_build = {
'^Server$': [
{
'image-build': {
'format': [('qcow2', 'qcow2'),],
'name': 'fedora-guest-image',
'target': 'guest-fedora-26-image',
'version': '26',
'ksurl': "git://git.example.com/ks.git?fedora#HEAD",
'kickstart': "fedora-26-kvm.ks",
'ksversion': 'f26',
'distro': 'fedora-26',
'disk-size': '10',
'arches': ['x86_64'],
'repo': ["http://example.com/linux/fedora/26/Everything/x86_64/os", ]
}
},
{
'image-build': {
'format': [('qcow2', 'qcow2'),],
'name': 'fedora-guest-image',
'target': 'guest-fedora-26-image',
'version': '26',
'ksurl': "git://git.example.com/ks.git?fedora#HEAD",
'kickstart': "fedora-26-kvm.ks",
'ksversion': 'f26',
'distro': 'fedora-26',
'disk-size': '10',
'arches': ['ppc64le'],
}
},
],
}
In this case, config file "qcow2_guest-fedora-26-image.cfg" will be
created for both x86_64 and ppc64le under the same variant dir, and
there is a high chance it will be over-written while Pungi creating the
koji task. We can add arch name(s) in config filename to avoid that.
Signed-off-by: Qixiang Wan <qwan@redhat.com>
2017-08-31 08:10:52 +00:00
|
|
|
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base_x86_64.cfg',
|
2016-02-11 14:15:36 +00:00
|
|
|
"image_dir": self.topdir + '/compose/Server/%(arch)s/images',
|
|
|
|
"relative_image_dir": 'Server/%(arch)s/images',
|
2016-01-08 12:37:09 +00:00
|
|
|
"link_type": 'hardlink-or-copy',
|
2016-01-26 11:46:50 +00:00
|
|
|
"scratch": False,
|
2016-01-08 12:37:09 +00:00
|
|
|
})
|
|
|
|
|
2016-01-21 13:30:44 +00:00
|
|
|
@mock.patch('pungi.phases.image_build.ThreadPool')
|
2016-05-23 13:23:12 +00:00
|
|
|
def test_image_build_set_external_install_tree(self, ThreadPool):
|
|
|
|
compose = DummyCompose(self.topdir, {
|
|
|
|
'image_build': {
|
|
|
|
'^Server$': [
|
|
|
|
{
|
|
|
|
'image-build': {
|
2017-10-30 12:23:49 +00:00
|
|
|
'format': ['docker'],
|
2016-05-23 13:23:12 +00:00
|
|
|
'name': 'Fedora-Docker-Base',
|
|
|
|
'target': 'f24',
|
|
|
|
'version': 'Rawhide',
|
|
|
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
|
|
|
'kickstart': "fedora-docker-base.ks",
|
|
|
|
'distro': 'Fedora-20',
|
|
|
|
'disk_size': 3,
|
|
|
|
'arches': ['x86_64'],
|
|
|
|
'install_tree_from': 'http://example.com/install-tree/',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
'koji_profile': 'koji',
|
|
|
|
})
|
|
|
|
|
2016-12-07 14:57:35 +00:00
|
|
|
self.assertValidConfig(compose.conf)
|
2016-08-22 14:08:25 +00:00
|
|
|
|
2016-05-23 13:23:12 +00:00
|
|
|
phase = ImageBuildPhase(compose)
|
|
|
|
|
|
|
|
phase.run()
|
|
|
|
|
|
|
|
# assert at least one thread was started
|
|
|
|
self.assertTrue(phase.pool.add.called)
|
|
|
|
|
|
|
|
self.assertTrue(phase.pool.queue_put.called_once)
|
|
|
|
args, kwargs = phase.pool.queue_put.call_args
|
|
|
|
self.assertEqual(args[0][0], compose)
|
|
|
|
self.assertDictEqual(args[0][1], {
|
|
|
|
"image_conf": {
|
|
|
|
'image-build': {
|
|
|
|
'install_tree': 'http://example.com/install-tree/',
|
|
|
|
'kickstart': 'fedora-docker-base.ks',
|
2017-10-30 12:23:49 +00:00
|
|
|
'format': ['docker'],
|
2016-05-23 13:23:12 +00:00
|
|
|
'repo': ','.join([self.topdir + '/compose/Server/$arch/os']),
|
|
|
|
'variant': compose.variants['Server'],
|
|
|
|
'target': 'f24',
|
|
|
|
'disk_size': 3,
|
|
|
|
'name': 'Fedora-Docker-Base',
|
2017-01-24 07:36:33 +00:00
|
|
|
'arches': ['x86_64'],
|
2016-05-23 13:23:12 +00:00
|
|
|
'version': 'Rawhide',
|
|
|
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
|
|
|
'distro': 'Fedora-20',
|
|
|
|
}
|
|
|
|
},
|
image-build: add arch name(s) in image config file name
Pungi write image config file with name of <format>-<name>.cfg, if there
are two or more image configs present for different arches under the same
variant and with same format & name, the config file can be overwritten,
and result in invalid image conf file.
Example:
image_build = {
'^Server$': [
{
'image-build': {
'format': [('qcow2', 'qcow2'),],
'name': 'fedora-guest-image',
'target': 'guest-fedora-26-image',
'version': '26',
'ksurl': "git://git.example.com/ks.git?fedora#HEAD",
'kickstart': "fedora-26-kvm.ks",
'ksversion': 'f26',
'distro': 'fedora-26',
'disk-size': '10',
'arches': ['x86_64'],
'repo': ["http://example.com/linux/fedora/26/Everything/x86_64/os", ]
}
},
{
'image-build': {
'format': [('qcow2', 'qcow2'),],
'name': 'fedora-guest-image',
'target': 'guest-fedora-26-image',
'version': '26',
'ksurl': "git://git.example.com/ks.git?fedora#HEAD",
'kickstart': "fedora-26-kvm.ks",
'ksversion': 'f26',
'distro': 'fedora-26',
'disk-size': '10',
'arches': ['ppc64le'],
}
},
],
}
In this case, config file "qcow2_guest-fedora-26-image.cfg" will be
created for both x86_64 and ppc64le under the same variant dir, and
there is a high chance it will be over-written while Pungi creating the
koji task. We can add arch name(s) in config filename to avoid that.
Signed-off-by: Qixiang Wan <qwan@redhat.com>
2017-08-31 08:10:52 +00:00
|
|
|
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base_x86_64.cfg',
|
2016-05-23 13:23:12 +00:00
|
|
|
"image_dir": self.topdir + '/compose/Server/%(arch)s/images',
|
|
|
|
"relative_image_dir": 'Server/%(arch)s/images',
|
|
|
|
"link_type": 'hardlink-or-copy',
|
|
|
|
"scratch": False,
|
|
|
|
})
|
|
|
|
|
|
|
|
@mock.patch('pungi.phases.image_build.ThreadPool')
|
2016-01-21 13:30:44 +00:00
|
|
|
def test_image_build_create_release(self, ThreadPool):
|
2016-02-22 14:58:34 +00:00
|
|
|
compose = DummyCompose(self.topdir, {
|
2016-01-21 13:30:44 +00:00
|
|
|
'image_build': {
|
|
|
|
'^Server$': [
|
|
|
|
{
|
2016-02-11 12:22:03 +00:00
|
|
|
'image-build': {
|
2017-10-30 12:23:49 +00:00
|
|
|
'format': ['docker'],
|
2016-02-11 12:22:03 +00:00
|
|
|
'name': 'Fedora-Docker-Base',
|
|
|
|
'target': 'f24',
|
|
|
|
'version': 'Rawhide',
|
|
|
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
|
|
|
'kickstart': "fedora-docker-base.ks",
|
|
|
|
'distro': 'Fedora-20',
|
|
|
|
'disk_size': 3,
|
|
|
|
'arches': ['x86_64'],
|
|
|
|
'release': None,
|
|
|
|
}
|
2016-01-21 13:30:44 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
'koji_profile': 'koji',
|
|
|
|
})
|
|
|
|
|
2016-12-07 14:57:35 +00:00
|
|
|
self.assertValidConfig(compose.conf)
|
2016-08-22 14:08:25 +00:00
|
|
|
|
2016-01-21 13:30:44 +00:00
|
|
|
phase = ImageBuildPhase(compose)
|
|
|
|
|
|
|
|
phase.run()
|
|
|
|
|
|
|
|
# assert at least one thread was started
|
|
|
|
self.assertTrue(phase.pool.add.called)
|
|
|
|
|
|
|
|
self.assertTrue(phase.pool.queue_put.called_once)
|
|
|
|
args, kwargs = phase.pool.queue_put.call_args
|
2016-02-11 12:22:03 +00:00
|
|
|
self.assertEqual(args[0][1].get('image_conf', {}).get('image-build', {}).get('release'),
|
2016-03-22 07:56:51 +00:00
|
|
|
'20151203.t.0')
|
2016-01-21 13:30:44 +00:00
|
|
|
|
2017-04-07 13:33:43 +00:00
|
|
|
@mock.patch('pungi.phases.image_build.ThreadPool')
|
|
|
|
def test_image_build_create_release_with_explicit_config(self, ThreadPool):
|
|
|
|
compose = DummyCompose(self.topdir, {
|
|
|
|
'image_build': {
|
|
|
|
'^Server$': [
|
|
|
|
{
|
|
|
|
'image-build': {
|
2017-10-30 12:23:49 +00:00
|
|
|
'format': ['docker'],
|
2017-04-07 13:33:43 +00:00
|
|
|
'name': 'Fedora-Docker-Base',
|
|
|
|
'target': 'f24',
|
|
|
|
'version': 'Rawhide',
|
|
|
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
|
|
|
'kickstart': "fedora-docker-base.ks",
|
|
|
|
'distro': 'Fedora-20',
|
|
|
|
'disk_size': 3,
|
|
|
|
'arches': ['x86_64'],
|
|
|
|
'release': '!RELEASE_FROM_LABEL_DATE_TYPE_RESPIN',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
'koji_profile': 'koji',
|
|
|
|
})
|
|
|
|
|
|
|
|
self.assertValidConfig(compose.conf)
|
|
|
|
|
|
|
|
phase = ImageBuildPhase(compose)
|
|
|
|
|
|
|
|
phase.run()
|
|
|
|
|
|
|
|
# assert at least one thread was started
|
|
|
|
self.assertTrue(phase.pool.add.called)
|
|
|
|
|
|
|
|
self.assertTrue(phase.pool.queue_put.called_once)
|
|
|
|
args, kwargs = phase.pool.queue_put.call_args
|
|
|
|
self.assertEqual(args[0][1].get('image_conf', {}).get('image-build', {}).get('release'),
|
|
|
|
'20151203.t.0')
|
|
|
|
|
2016-01-26 11:46:50 +00:00
|
|
|
@mock.patch('pungi.phases.image_build.ThreadPool')
|
|
|
|
def test_image_build_scratch_build(self, ThreadPool):
|
2016-02-22 14:58:34 +00:00
|
|
|
compose = DummyCompose(self.topdir, {
|
2016-01-26 11:46:50 +00:00
|
|
|
'image_build': {
|
|
|
|
'^Server$': [
|
|
|
|
{
|
2016-02-11 12:22:03 +00:00
|
|
|
'image-build': {
|
2017-10-30 12:23:49 +00:00
|
|
|
'format': ['docker'],
|
2016-02-11 12:22:03 +00:00
|
|
|
'name': 'Fedora-Docker-Base',
|
|
|
|
'target': 'f24',
|
|
|
|
'version': 'Rawhide',
|
|
|
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
|
|
|
'kickstart': "fedora-docker-base.ks",
|
|
|
|
'distro': 'Fedora-20',
|
|
|
|
'disk_size': 3,
|
|
|
|
'arches': ['x86_64'],
|
|
|
|
'scratch': True,
|
|
|
|
}
|
2016-01-26 11:46:50 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
'koji_profile': 'koji',
|
|
|
|
})
|
|
|
|
|
2016-12-07 14:57:35 +00:00
|
|
|
self.assertValidConfig(compose.conf)
|
2016-08-22 14:08:25 +00:00
|
|
|
|
2016-01-26 11:46:50 +00:00
|
|
|
phase = ImageBuildPhase(compose)
|
|
|
|
|
|
|
|
phase.run()
|
|
|
|
|
|
|
|
# assert at least one thread was started
|
|
|
|
self.assertTrue(phase.pool.add.called)
|
|
|
|
|
|
|
|
self.assertTrue(phase.pool.queue_put.called_once)
|
|
|
|
args, kwargs = phase.pool.queue_put.call_args
|
|
|
|
self.assertTrue(args[0][1].get('scratch'))
|
|
|
|
|
2016-11-24 13:53:30 +00:00
|
|
|
@mock.patch('pungi.phases.image_build.ThreadPool')
|
|
|
|
def test_image_build_optional(self, ThreadPool):
|
|
|
|
compose = DummyCompose(self.topdir, {
|
|
|
|
'image_build': {
|
|
|
|
'^Server-optional$': [
|
|
|
|
{
|
|
|
|
'image-build': {
|
2017-10-30 12:23:49 +00:00
|
|
|
'format': ['docker'],
|
2016-11-24 13:53:30 +00:00
|
|
|
'name': 'Fedora-Docker-Base',
|
|
|
|
'target': 'f24',
|
|
|
|
'version': 'Rawhide',
|
|
|
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
|
|
|
'kickstart': "fedora-docker-base.ks",
|
|
|
|
'distro': 'Fedora-20',
|
|
|
|
'disk_size': 3,
|
|
|
|
'failable': ['x86_64'],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
'koji_profile': 'koji',
|
|
|
|
})
|
|
|
|
compose.setup_optional()
|
|
|
|
|
|
|
|
self.assertValidConfig(compose.conf)
|
|
|
|
|
|
|
|
phase = ImageBuildPhase(compose)
|
|
|
|
|
|
|
|
phase.run()
|
|
|
|
|
|
|
|
# assert at least one thread was started
|
|
|
|
self.assertTrue(phase.pool.add.called)
|
|
|
|
server_args = {
|
|
|
|
"image_conf": {
|
|
|
|
'image-build': {
|
|
|
|
'install_tree': self.topdir + '/compose/Server/$arch/os',
|
|
|
|
'kickstart': 'fedora-docker-base.ks',
|
2017-10-30 12:23:49 +00:00
|
|
|
'format': ['docker'],
|
2016-11-24 13:53:30 +00:00
|
|
|
'repo': self.topdir + '/compose/Server-optional/$arch/os',
|
|
|
|
'variant': compose.all_variants['Server-optional'],
|
|
|
|
'target': 'f24',
|
|
|
|
'disk_size': 3,
|
|
|
|
'name': 'Fedora-Docker-Base',
|
2017-01-24 07:36:33 +00:00
|
|
|
'arches': ['x86_64'],
|
2016-11-24 13:53:30 +00:00
|
|
|
'version': 'Rawhide',
|
|
|
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
|
|
|
'distro': 'Fedora-20',
|
2017-01-24 07:36:33 +00:00
|
|
|
'can_fail': ['x86_64'],
|
2016-11-24 13:53:30 +00:00
|
|
|
}
|
|
|
|
},
|
image-build: add arch name(s) in image config file name
Pungi write image config file with name of <format>-<name>.cfg, if there
are two or more image configs present for different arches under the same
variant and with same format & name, the config file can be overwritten,
and result in invalid image conf file.
Example:
image_build = {
'^Server$': [
{
'image-build': {
'format': [('qcow2', 'qcow2'),],
'name': 'fedora-guest-image',
'target': 'guest-fedora-26-image',
'version': '26',
'ksurl': "git://git.example.com/ks.git?fedora#HEAD",
'kickstart': "fedora-26-kvm.ks",
'ksversion': 'f26',
'distro': 'fedora-26',
'disk-size': '10',
'arches': ['x86_64'],
'repo': ["http://example.com/linux/fedora/26/Everything/x86_64/os", ]
}
},
{
'image-build': {
'format': [('qcow2', 'qcow2'),],
'name': 'fedora-guest-image',
'target': 'guest-fedora-26-image',
'version': '26',
'ksurl': "git://git.example.com/ks.git?fedora#HEAD",
'kickstart': "fedora-26-kvm.ks",
'ksversion': 'f26',
'distro': 'fedora-26',
'disk-size': '10',
'arches': ['ppc64le'],
}
},
],
}
In this case, config file "qcow2_guest-fedora-26-image.cfg" will be
created for both x86_64 and ppc64le under the same variant dir, and
there is a high chance it will be over-written while Pungi creating the
koji task. We can add arch name(s) in config filename to avoid that.
Signed-off-by: Qixiang Wan <qwan@redhat.com>
2017-08-31 08:10:52 +00:00
|
|
|
"conf_file": self.topdir + '/work/image-build/Server-optional/docker_Fedora-Docker-Base_x86_64.cfg',
|
2016-11-24 13:53:30 +00:00
|
|
|
"image_dir": self.topdir + '/compose/Server-optional/%(arch)s/images',
|
|
|
|
"relative_image_dir": 'Server-optional/%(arch)s/images',
|
|
|
|
"link_type": 'hardlink-or-copy',
|
|
|
|
"scratch": False,
|
|
|
|
}
|
|
|
|
self.assertItemsEqual(phase.pool.queue_put.mock_calls,
|
|
|
|
[mock.call((compose, server_args))])
|
|
|
|
|
2017-01-23 15:52:57 +00:00
|
|
|
@mock.patch('pungi.phases.image_build.ThreadPool')
|
|
|
|
def test_failable_star(self, ThreadPool):
|
|
|
|
compose = DummyCompose(self.topdir, {
|
|
|
|
'image_build': {
|
|
|
|
'^Server$': [
|
|
|
|
{
|
|
|
|
'image-build': {
|
2017-10-30 12:23:49 +00:00
|
|
|
'format': ['docker'],
|
2017-01-23 15:52:57 +00:00
|
|
|
'name': 'Fedora-Docker-Base',
|
|
|
|
'target': 'f24',
|
|
|
|
'version': 'Rawhide',
|
|
|
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
|
|
|
'kickstart': "fedora-docker-base.ks",
|
|
|
|
'distro': 'Fedora-20',
|
|
|
|
'disk_size': 3,
|
|
|
|
'failable': ['*'],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
'koji_profile': 'koji',
|
|
|
|
})
|
|
|
|
compose.setup_optional()
|
|
|
|
|
|
|
|
self.assertValidConfig(compose.conf)
|
|
|
|
|
|
|
|
phase = ImageBuildPhase(compose)
|
|
|
|
|
|
|
|
phase.run()
|
|
|
|
|
|
|
|
# assert at least one thread was started
|
|
|
|
self.assertTrue(phase.pool.add.called)
|
|
|
|
server_args = {
|
|
|
|
"image_conf": {
|
|
|
|
'image-build': {
|
|
|
|
'install_tree': self.topdir + '/compose/Server/$arch/os',
|
|
|
|
'kickstart': 'fedora-docker-base.ks',
|
2017-10-30 12:23:49 +00:00
|
|
|
'format': ['docker'],
|
2017-01-23 15:52:57 +00:00
|
|
|
'repo': self.topdir + '/compose/Server/$arch/os',
|
|
|
|
'variant': compose.all_variants['Server'],
|
|
|
|
'target': 'f24',
|
|
|
|
'disk_size': 3,
|
|
|
|
'name': 'Fedora-Docker-Base',
|
2017-01-24 07:36:33 +00:00
|
|
|
'arches': ['amd64', 'x86_64'],
|
2017-01-23 15:52:57 +00:00
|
|
|
'version': 'Rawhide',
|
|
|
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
|
|
|
'distro': 'Fedora-20',
|
2017-01-24 07:36:33 +00:00
|
|
|
'can_fail': ['amd64', 'x86_64'],
|
2017-01-23 15:52:57 +00:00
|
|
|
}
|
|
|
|
},
|
image-build: add arch name(s) in image config file name
Pungi write image config file with name of <format>-<name>.cfg, if there
are two or more image configs present for different arches under the same
variant and with same format & name, the config file can be overwritten,
and result in invalid image conf file.
Example:
image_build = {
'^Server$': [
{
'image-build': {
'format': [('qcow2', 'qcow2'),],
'name': 'fedora-guest-image',
'target': 'guest-fedora-26-image',
'version': '26',
'ksurl': "git://git.example.com/ks.git?fedora#HEAD",
'kickstart': "fedora-26-kvm.ks",
'ksversion': 'f26',
'distro': 'fedora-26',
'disk-size': '10',
'arches': ['x86_64'],
'repo': ["http://example.com/linux/fedora/26/Everything/x86_64/os", ]
}
},
{
'image-build': {
'format': [('qcow2', 'qcow2'),],
'name': 'fedora-guest-image',
'target': 'guest-fedora-26-image',
'version': '26',
'ksurl': "git://git.example.com/ks.git?fedora#HEAD",
'kickstart': "fedora-26-kvm.ks",
'ksversion': 'f26',
'distro': 'fedora-26',
'disk-size': '10',
'arches': ['ppc64le'],
}
},
],
}
In this case, config file "qcow2_guest-fedora-26-image.cfg" will be
created for both x86_64 and ppc64le under the same variant dir, and
there is a high chance it will be over-written while Pungi creating the
koji task. We can add arch name(s) in config filename to avoid that.
Signed-off-by: Qixiang Wan <qwan@redhat.com>
2017-08-31 08:10:52 +00:00
|
|
|
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base_amd64-x86_64.cfg',
|
2017-01-23 15:52:57 +00:00
|
|
|
"image_dir": self.topdir + '/compose/Server/%(arch)s/images',
|
|
|
|
"relative_image_dir": 'Server/%(arch)s/images',
|
|
|
|
"link_type": 'hardlink-or-copy',
|
|
|
|
"scratch": False,
|
|
|
|
}
|
|
|
|
self.assertItemsEqual(phase.pool.queue_put.mock_calls,
|
|
|
|
[mock.call((compose, server_args))])
|
|
|
|
|
2016-01-05 08:27:20 +00:00
|
|
|
|
2016-02-11 14:15:36 +00:00
|
|
|
class TestCreateImageBuildThread(PungiTestCase):
|
2016-01-05 08:27:20 +00:00
|
|
|
|
2016-02-11 14:15:36 +00:00
|
|
|
@mock.patch('pungi.phases.image_build.get_mtime')
|
|
|
|
@mock.patch('pungi.phases.image_build.get_file_size')
|
2016-01-05 08:27:20 +00:00
|
|
|
@mock.patch('pungi.phases.image_build.KojiWrapper')
|
|
|
|
@mock.patch('pungi.phases.image_build.Linker')
|
2016-02-11 14:15:36 +00:00
|
|
|
def test_process(self, Linker, KojiWrapper, get_file_size, get_mtime):
|
2016-02-22 14:58:34 +00:00
|
|
|
compose = DummyCompose(self.topdir, {
|
2016-01-05 08:27:20 +00:00
|
|
|
'koji_profile': 'koji'
|
|
|
|
})
|
|
|
|
pool = mock.Mock()
|
|
|
|
cmd = {
|
|
|
|
"image_conf": {
|
2016-02-11 12:22:03 +00:00
|
|
|
'image-build': {
|
|
|
|
'install_tree': '/ostree/$arch/Client',
|
|
|
|
'kickstart': 'fedora-docker-base.ks',
|
2017-10-30 12:23:49 +00:00
|
|
|
'format': ['docker', 'qcow2'],
|
2016-02-11 12:22:03 +00:00
|
|
|
'repo': '/ostree/$arch/Client',
|
|
|
|
'variant': compose.variants['Client'],
|
|
|
|
'target': 'f24',
|
|
|
|
'disk_size': 3,
|
|
|
|
'name': 'Fedora-Docker-Base',
|
2017-01-24 07:36:33 +00:00
|
|
|
'arches': ['amd64', 'x86_64'],
|
2016-02-11 12:22:03 +00:00
|
|
|
'version': 'Rawhide',
|
|
|
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
|
|
|
'distro': 'Fedora-20',
|
2016-03-17 08:21:35 +00:00
|
|
|
'subvariant': 'KDE',
|
2016-02-11 12:22:03 +00:00
|
|
|
}
|
2016-01-05 08:27:20 +00:00
|
|
|
},
|
|
|
|
"conf_file": 'amd64,x86_64-Client-Fedora-Docker-Base-docker',
|
2016-02-11 14:15:36 +00:00
|
|
|
"image_dir": self.topdir + '/compose/Client/%(arch)s/images',
|
2016-01-05 08:27:20 +00:00
|
|
|
"relative_image_dir": 'image_dir/Client/%(arch)s',
|
|
|
|
"link_type": 'hardlink-or-copy',
|
2016-01-26 11:46:50 +00:00
|
|
|
"scratch": False,
|
2016-01-05 08:27:20 +00:00
|
|
|
}
|
|
|
|
koji_wrapper = KojiWrapper.return_value
|
2016-01-28 13:58:24 +00:00
|
|
|
koji_wrapper.run_blocking_cmd.return_value = {
|
2016-01-05 08:27:20 +00:00
|
|
|
"retcode": 0,
|
|
|
|
"output": None,
|
|
|
|
"task_id": 1234,
|
|
|
|
}
|
2016-01-28 13:58:24 +00:00
|
|
|
koji_wrapper.get_image_paths.return_value = {
|
2016-01-05 08:27:20 +00:00
|
|
|
'amd64': [
|
|
|
|
'/koji/task/1235/tdl-amd64.xml',
|
|
|
|
'/koji/task/1235/Fedora-Docker-Base-20160103.amd64.qcow2',
|
2017-10-30 12:23:49 +00:00
|
|
|
'/koji/task/1235/Fedora-Docker-Base-20160103.amd64.tar.gz'
|
2016-01-05 08:27:20 +00:00
|
|
|
],
|
|
|
|
'x86_64': [
|
|
|
|
'/koji/task/1235/tdl-x86_64.xml',
|
|
|
|
'/koji/task/1235/Fedora-Docker-Base-20160103.x86_64.qcow2',
|
2017-10-30 12:23:49 +00:00
|
|
|
'/koji/task/1235/Fedora-Docker-Base-20160103.x86_64.tar.gz'
|
2016-01-05 08:27:20 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
linker = Linker.return_value
|
2016-02-11 14:15:36 +00:00
|
|
|
get_file_size.return_value = 1024
|
|
|
|
get_mtime.return_value = 13579
|
2016-01-05 08:27:20 +00:00
|
|
|
|
|
|
|
t = CreateImageBuildThread(pool)
|
2016-02-11 14:15:36 +00:00
|
|
|
with mock.patch('time.sleep'):
|
|
|
|
t.process((compose, cmd), 1)
|
2016-01-05 08:27:20 +00:00
|
|
|
|
2016-03-17 08:21:35 +00:00
|
|
|
self.assertItemsEqual(
|
|
|
|
koji_wrapper.get_image_build_cmd.call_args_list,
|
|
|
|
[mock.call(cmd['image_conf'],
|
|
|
|
conf_file_dest='amd64,x86_64-Client-Fedora-Docker-Base-docker',
|
|
|
|
scratch=False)]
|
|
|
|
)
|
|
|
|
|
|
|
|
self.assertItemsEqual(
|
|
|
|
koji_wrapper.run_blocking_cmd.call_args_list,
|
|
|
|
[mock.call(koji_wrapper.get_image_build_cmd.return_value,
|
2017-10-30 12:23:49 +00:00
|
|
|
log_file=self.topdir + '/logs/amd64-x86_64/imagebuild-Client-KDE-docker-qcow2.amd64-x86_64.log')]
|
2016-03-17 08:21:35 +00:00
|
|
|
)
|
|
|
|
|
2016-01-05 08:27:20 +00:00
|
|
|
self.assertItemsEqual(
|
|
|
|
linker.mock_calls,
|
2016-05-25 11:37:39 +00:00
|
|
|
[mock.call.link(
|
|
|
|
'/koji/task/1235/Fedora-Docker-Base-20160103.amd64.qcow2',
|
|
|
|
self.topdir + '/compose/Client/amd64/images/Fedora-Docker-Base-20160103.amd64.qcow2',
|
|
|
|
link_type='hardlink-or-copy'),
|
|
|
|
mock.call.link(
|
2017-10-30 12:23:49 +00:00
|
|
|
'/koji/task/1235/Fedora-Docker-Base-20160103.amd64.tar.gz',
|
|
|
|
self.topdir + '/compose/Client/amd64/images/Fedora-Docker-Base-20160103.amd64.tar.gz',
|
2016-05-25 11:37:39 +00:00
|
|
|
link_type='hardlink-or-copy'),
|
|
|
|
mock.call.link(
|
|
|
|
'/koji/task/1235/Fedora-Docker-Base-20160103.x86_64.qcow2',
|
|
|
|
self.topdir + '/compose/Client/x86_64/images/Fedora-Docker-Base-20160103.x86_64.qcow2',
|
|
|
|
link_type='hardlink-or-copy'),
|
|
|
|
mock.call.link(
|
2017-10-30 12:23:49 +00:00
|
|
|
'/koji/task/1235/Fedora-Docker-Base-20160103.x86_64.tar.gz',
|
|
|
|
self.topdir + '/compose/Client/x86_64/images/Fedora-Docker-Base-20160103.x86_64.tar.gz',
|
2016-05-25 11:37:39 +00:00
|
|
|
link_type='hardlink-or-copy')])
|
2016-01-05 08:27:20 +00:00
|
|
|
|
|
|
|
image_relative_paths = {
|
|
|
|
'image_dir/Client/amd64/Fedora-Docker-Base-20160103.amd64.qcow2': {
|
|
|
|
'format': 'qcow2',
|
|
|
|
'type': 'qcow2',
|
|
|
|
'arch': 'amd64',
|
|
|
|
},
|
2017-10-30 12:23:49 +00:00
|
|
|
'image_dir/Client/amd64/Fedora-Docker-Base-20160103.amd64.tar.gz': {
|
|
|
|
'format': 'tar.gz',
|
2016-01-05 08:27:20 +00:00
|
|
|
'type': 'docker',
|
|
|
|
'arch': 'amd64',
|
|
|
|
},
|
|
|
|
'image_dir/Client/x86_64/Fedora-Docker-Base-20160103.x86_64.qcow2': {
|
|
|
|
'format': 'qcow2',
|
|
|
|
'type': 'qcow2',
|
|
|
|
'arch': 'x86_64',
|
|
|
|
},
|
2017-10-30 12:23:49 +00:00
|
|
|
'image_dir/Client/x86_64/Fedora-Docker-Base-20160103.x86_64.tar.gz': {
|
|
|
|
'format': 'tar.gz',
|
2016-01-05 08:27:20 +00:00
|
|
|
'type': 'docker',
|
|
|
|
'arch': 'x86_64',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
# Assert there are 4 images added to manifest and the arguments are sane
|
|
|
|
self.assertEqual(len(compose.im.add.call_args_list), 4)
|
|
|
|
for call in compose.im.add.call_args_list:
|
|
|
|
_, kwargs = call
|
|
|
|
image = kwargs['image']
|
|
|
|
self.assertEqual(kwargs['variant'], 'Client')
|
|
|
|
self.assertIn(kwargs['arch'], ('amd64', 'x86_64'))
|
|
|
|
self.assertEqual(kwargs['arch'], image.arch)
|
|
|
|
self.assertIn(image.path, image_relative_paths)
|
|
|
|
data = image_relative_paths.pop(image.path)
|
|
|
|
self.assertEqual(data['format'], image.format)
|
|
|
|
self.assertEqual(data['type'], image.type)
|
2016-03-17 08:21:35 +00:00
|
|
|
self.assertEqual('KDE', image.subvariant)
|
2016-01-05 08:27:20 +00:00
|
|
|
|
2016-02-11 14:15:36 +00:00
|
|
|
self.assertTrue(os.path.isdir(self.topdir + '/compose/Client/amd64/images'))
|
|
|
|
self.assertTrue(os.path.isdir(self.topdir + '/compose/Client/x86_64/images'))
|
2016-01-19 07:24:02 +00:00
|
|
|
|
2016-01-11 16:14:51 +00:00
|
|
|
@mock.patch('pungi.phases.image_build.KojiWrapper')
|
|
|
|
@mock.patch('pungi.phases.image_build.Linker')
|
|
|
|
def test_process_handle_fail(self, Linker, KojiWrapper):
|
2016-06-24 07:44:40 +00:00
|
|
|
compose = DummyCompose(self.topdir, {'koji_profile': 'koji'})
|
2016-01-11 16:14:51 +00:00
|
|
|
pool = mock.Mock()
|
|
|
|
cmd = {
|
|
|
|
"image_conf": {
|
2016-02-11 12:22:03 +00:00
|
|
|
'image-build': {
|
|
|
|
'install_tree': '/ostree/$arch/Client',
|
|
|
|
'kickstart': 'fedora-docker-base.ks',
|
2017-10-30 12:23:49 +00:00
|
|
|
'format': ['docker', 'qcow2'],
|
2016-02-11 12:22:03 +00:00
|
|
|
'repo': '/ostree/$arch/Client',
|
|
|
|
'variant': compose.variants['Client'],
|
|
|
|
'target': 'f24',
|
|
|
|
'disk_size': 3,
|
|
|
|
'name': 'Fedora-Docker-Base',
|
2017-01-24 07:36:33 +00:00
|
|
|
'arches': ['amd64', 'x86_64'],
|
2016-02-11 12:22:03 +00:00
|
|
|
'version': 'Rawhide',
|
|
|
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
|
|
|
'distro': 'Fedora-20',
|
2017-01-24 07:36:33 +00:00
|
|
|
"can_fail": ['amd64', 'x86_64'],
|
2016-02-11 12:22:03 +00:00
|
|
|
}
|
2016-01-11 16:14:51 +00:00
|
|
|
},
|
|
|
|
"conf_file": 'amd64,x86_64-Client-Fedora-Docker-Base-docker',
|
|
|
|
"image_dir": '/image_dir/Client/%(arch)s',
|
|
|
|
"relative_image_dir": 'image_dir/Client/%(arch)s',
|
|
|
|
"link_type": 'hardlink-or-copy',
|
2016-02-08 09:54:24 +00:00
|
|
|
'scratch': False,
|
2016-01-11 16:14:51 +00:00
|
|
|
}
|
|
|
|
koji_wrapper = KojiWrapper.return_value
|
2016-01-28 13:58:24 +00:00
|
|
|
koji_wrapper.run_blocking_cmd.return_value = {
|
2016-01-11 16:14:51 +00:00
|
|
|
"retcode": 1,
|
|
|
|
"output": None,
|
|
|
|
"task_id": 1234,
|
|
|
|
}
|
|
|
|
|
|
|
|
t = CreateImageBuildThread(pool)
|
2016-03-24 09:12:20 +00:00
|
|
|
with mock.patch('time.sleep'):
|
|
|
|
t.process((compose, cmd), 1)
|
|
|
|
|
2018-07-11 13:37:21 +00:00
|
|
|
pool._logger.error.assert_has_calls([
|
2016-04-13 11:44:17 +00:00
|
|
|
mock.call('[FAIL] Image build (variant Client, arch *, subvariant Client) failed, but going on anyway.'),
|
2016-03-24 09:12:20 +00:00
|
|
|
mock.call('ImageBuild task failed: 1234. See %s for more details.'
|
|
|
|
% (os.path.join(self.topdir,
|
2017-10-30 12:23:49 +00:00
|
|
|
'logs/amd64-x86_64/imagebuild-Client-Client-docker-qcow2.amd64-x86_64.log'))),
|
2016-03-24 09:12:20 +00:00
|
|
|
])
|
2016-01-11 16:14:51 +00:00
|
|
|
|
|
|
|
@mock.patch('pungi.phases.image_build.KojiWrapper')
|
|
|
|
@mock.patch('pungi.phases.image_build.Linker')
|
|
|
|
def test_process_handle_exception(self, Linker, KojiWrapper):
|
2016-06-24 07:44:40 +00:00
|
|
|
compose = DummyCompose(self.topdir, {'koji_profile': 'koji'})
|
2016-01-11 16:14:51 +00:00
|
|
|
pool = mock.Mock()
|
|
|
|
cmd = {
|
|
|
|
"image_conf": {
|
2016-02-11 12:22:03 +00:00
|
|
|
'image-build': {
|
|
|
|
'install_tree': '/ostree/$arch/Client',
|
|
|
|
'kickstart': 'fedora-docker-base.ks',
|
2017-10-30 12:23:49 +00:00
|
|
|
'format': ['docker', 'qcow2'],
|
2016-02-11 12:22:03 +00:00
|
|
|
'repo': '/ostree/$arch/Client',
|
|
|
|
'variant': compose.variants['Client'],
|
|
|
|
'target': 'f24',
|
|
|
|
'disk_size': 3,
|
|
|
|
'name': 'Fedora-Docker-Base',
|
2017-01-24 07:36:33 +00:00
|
|
|
'arches': ['amd64', 'x86_64'],
|
2016-02-11 12:22:03 +00:00
|
|
|
'version': 'Rawhide',
|
|
|
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
|
|
|
'distro': 'Fedora-20',
|
2017-01-24 07:36:33 +00:00
|
|
|
'can_fail': ['amd64', 'x86_64'],
|
2016-02-11 12:22:03 +00:00
|
|
|
}
|
2016-01-11 16:14:51 +00:00
|
|
|
},
|
|
|
|
"conf_file": 'amd64,x86_64-Client-Fedora-Docker-Base-docker',
|
|
|
|
"image_dir": '/image_dir/Client/%(arch)s',
|
|
|
|
"relative_image_dir": 'image_dir/Client/%(arch)s',
|
|
|
|
"link_type": 'hardlink-or-copy',
|
2016-02-08 09:54:24 +00:00
|
|
|
'scratch': False,
|
2016-01-11 16:14:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
koji_wrapper = KojiWrapper.return_value
|
2016-01-28 13:58:24 +00:00
|
|
|
koji_wrapper.run_blocking_cmd.side_effect = boom
|
2016-01-11 16:14:51 +00:00
|
|
|
|
|
|
|
t = CreateImageBuildThread(pool)
|
2016-03-24 09:12:20 +00:00
|
|
|
with mock.patch('time.sleep'):
|
|
|
|
t.process((compose, cmd), 1)
|
|
|
|
|
2018-07-11 13:37:21 +00:00
|
|
|
pool._logger.error.assert_has_calls([
|
2016-04-13 11:44:17 +00:00
|
|
|
mock.call('[FAIL] Image build (variant Client, arch *, subvariant Client) failed, but going on anyway.'),
|
2016-03-24 09:12:20 +00:00
|
|
|
mock.call('BOOM'),
|
|
|
|
])
|
2016-01-11 16:14:51 +00:00
|
|
|
|
2016-11-28 14:28:00 +00:00
|
|
|
@mock.patch('pungi.phases.image_build.KojiWrapper')
|
|
|
|
@mock.patch('pungi.phases.image_build.Linker')
|
|
|
|
def test_process_handle_fail_only_one_optional(self, Linker, KojiWrapper):
|
|
|
|
compose = DummyCompose(self.topdir, {'koji_profile': 'koji'})
|
|
|
|
pool = mock.Mock()
|
|
|
|
cmd = {
|
|
|
|
"image_conf": {
|
|
|
|
'image-build': {
|
|
|
|
'install_tree': '/ostree/$arch/Client',
|
|
|
|
'kickstart': 'fedora-docker-base.ks',
|
2017-10-30 12:23:49 +00:00
|
|
|
'format': ['docker', 'qcow2'],
|
2016-11-28 14:28:00 +00:00
|
|
|
'repo': '/ostree/$arch/Client',
|
|
|
|
'variant': compose.variants['Client'],
|
|
|
|
'target': 'f24',
|
|
|
|
'disk_size': 3,
|
|
|
|
'name': 'Fedora-Docker-Base',
|
2017-01-24 07:36:33 +00:00
|
|
|
'arches': ['amd64', 'x86_64'],
|
2016-11-28 14:28:00 +00:00
|
|
|
'version': 'Rawhide',
|
|
|
|
'ksurl': 'git://git.fedorahosted.org/git/spin-kickstarts.git',
|
|
|
|
'distro': 'Fedora-20',
|
2017-01-24 07:36:33 +00:00
|
|
|
'can_fail': ['amd64'],
|
2016-11-28 14:28:00 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"conf_file": 'amd64,x86_64-Client-Fedora-Docker-Base-docker',
|
|
|
|
"image_dir": '/image_dir/Client/%(arch)s',
|
|
|
|
"relative_image_dir": 'image_dir/Client/%(arch)s',
|
|
|
|
"link_type": 'hardlink-or-copy',
|
|
|
|
'scratch': False,
|
|
|
|
}
|
|
|
|
|
|
|
|
koji_wrapper = KojiWrapper.return_value
|
|
|
|
koji_wrapper.run_blocking_cmd.return_value = {
|
|
|
|
"retcode": 1,
|
|
|
|
"output": None,
|
|
|
|
"task_id": 1234,
|
|
|
|
}
|
|
|
|
|
|
|
|
t = CreateImageBuildThread(pool)
|
|
|
|
with self.assertRaises(RuntimeError):
|
|
|
|
with mock.patch('time.sleep'):
|
|
|
|
t.process((compose, cmd), 1)
|
|
|
|
|
2016-01-05 08:27:20 +00:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
unittest.main()
|