Fix atomic/ostree config validations
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
4ec8ad5de8
commit
e5f37016e0
@ -14,13 +14,13 @@ from ..wrappers import kojiwrapper, iso, lorax
|
||||
class AtomicInstallerPhase(ConfigGuardedPhase):
|
||||
name = 'atomic'
|
||||
|
||||
config_options = (
|
||||
config_options = [
|
||||
{
|
||||
"name": "atomic",
|
||||
"expected_types": [dict],
|
||||
"expected_types": [list],
|
||||
"optional": True,
|
||||
}
|
||||
)
|
||||
]
|
||||
|
||||
def __init__(self, compose):
|
||||
super(AtomicInstallerPhase, self).__init__(compose)
|
||||
|
@ -13,13 +13,13 @@ from ..wrappers import scm, kojiwrapper
|
||||
class OSTreePhase(ConfigGuardedPhase):
|
||||
name = 'ostree'
|
||||
|
||||
config_options = (
|
||||
config_options = [
|
||||
{
|
||||
"name": "ostree",
|
||||
"expected_types": [dict],
|
||||
"expected_types": [list],
|
||||
"optional": True,
|
||||
}
|
||||
)
|
||||
]
|
||||
|
||||
def __init__(self, compose):
|
||||
super(OSTreePhase, self).__init__(compose)
|
||||
|
@ -16,6 +16,46 @@ from pungi.phases import atomic_installer as atomic
|
||||
|
||||
class AtomicInstallerPhaseTest(helpers.PungiTestCase):
|
||||
|
||||
def test_validate(self):
|
||||
compose = helpers.DummyCompose(self.topdir, {
|
||||
'atomic': [
|
||||
("^Atomic$", {
|
||||
"x86_64": {
|
||||
"source_repo_from": "Everything",
|
||||
"release": None,
|
||||
"filename": "%(release_short)s-%(variant)s-%(arch)s-%(version)s-%(compose_date)s.iso",
|
||||
"installpkgs": ["fedora-productimg-atomic"],
|
||||
"add_template": ["/spin-kickstarts/atomic-installer/lorax-configure-repo.tmpl"],
|
||||
"add_template_var": [
|
||||
"ostree_osname=fedora-atomic",
|
||||
"ostree_ref=fedora-atomic/Rawhide/x86_64/docker-host",
|
||||
],
|
||||
"add_arch_template": ["/spin-kickstarts/atomic-installer/lorax-embed-repo.tmpl"],
|
||||
"add_arch_template_var": [
|
||||
"ostree_repo=https://kojipkgs.fedoraproject.org/compose/atomic/Rawhide/",
|
||||
"ostree_osname=fedora-atomic",
|
||||
"ostree_ref=fedora-atomic/Rawhide/x86_64/docker-host",
|
||||
]
|
||||
}
|
||||
})
|
||||
]
|
||||
})
|
||||
|
||||
phase = atomic.AtomicInstallerPhase(compose)
|
||||
try:
|
||||
phase.validate()
|
||||
except:
|
||||
self.fail('Correct config must validate')
|
||||
|
||||
def test_validate_bad_conf(self):
|
||||
compose = helpers.DummyCompose(self.topdir, {
|
||||
'atomic': 'yes please'
|
||||
})
|
||||
|
||||
phase = atomic.AtomicInstallerPhase(compose)
|
||||
with self.assertRaises(ValueError):
|
||||
phase.validate()
|
||||
|
||||
@mock.patch('pungi.phases.atomic_installer.ThreadPool')
|
||||
def test_run(self, ThreadPool):
|
||||
cfg = mock.Mock()
|
||||
|
@ -16,6 +16,35 @@ from pungi.phases import ostree
|
||||
|
||||
class OSTreePhaseTest(helpers.PungiTestCase):
|
||||
|
||||
def test_validate(self):
|
||||
compose = helpers.DummyCompose(self.topdir, {
|
||||
'ostree': [
|
||||
("^Atomic$", {
|
||||
"x86_64": {
|
||||
"treefile": "fedora-atomic-docker-host.json",
|
||||
"config_url": "https://git.fedorahosted.org/git/fedora-atomic.git",
|
||||
"source_repo_from": "Everything",
|
||||
"atomic_repo": "/mnt/koji/compose/atomic/Rawhide/"
|
||||
}
|
||||
})
|
||||
]
|
||||
})
|
||||
|
||||
phase = ostree.OSTreePhase(compose)
|
||||
try:
|
||||
phase.validate()
|
||||
except:
|
||||
self.fail('Correct config must validate')
|
||||
|
||||
def test_validate_bad_conf(self):
|
||||
compose = helpers.DummyCompose(self.topdir, {
|
||||
'ostree': 'yes please'
|
||||
})
|
||||
|
||||
phase = ostree.OSTreePhase(compose)
|
||||
with self.assertRaises(ValueError):
|
||||
phase.validate()
|
||||
|
||||
@mock.patch('pungi.phases.ostree.ThreadPool')
|
||||
def test_run(self, ThreadPool):
|
||||
cfg = mock.Mock()
|
||||
|
Loading…
Reference in New Issue
Block a user