tests: Add a test for using [[customizations]] with [customizations.kernel]
Make sure this is really fixed by running the template tests with both variations. NOTE: [customizations] is the correct form. An early documentation bug led to both being accepted. Related: rhbz#1688335
This commit is contained in:
parent
5b2d894269
commit
41d822f754
@ -227,17 +227,8 @@ class CustomizationsTestCase(unittest.TestCase):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def test_customize_ks_template(self):
|
def _checkTemplates(self, recipe):
|
||||||
"""Test that [customizations.kernel] works correctly"""
|
"""Apply the recipe to all the templates"""
|
||||||
blueprint_data = """name = "test-kernel"
|
|
||||||
description = "test recipe"
|
|
||||||
version = "0.0.1"
|
|
||||||
|
|
||||||
[customizations.kernel]
|
|
||||||
append="nosmt=force"
|
|
||||||
"""
|
|
||||||
recipe = recipe_from_toml(blueprint_data)
|
|
||||||
|
|
||||||
# Test against a kickstart without bootloader
|
# Test against a kickstart without bootloader
|
||||||
result = customize_ks_template("firewall --enabled\n", recipe)
|
result = customize_ks_template("firewall --enabled\n", recipe)
|
||||||
self.assertTrue(self._checkBootloader(result, "nosmt=force"))
|
self.assertTrue(self._checkBootloader(result, "nosmt=force"))
|
||||||
@ -258,3 +249,30 @@ append="nosmt=force"
|
|||||||
print("%s:\n%s\n\n" % (e, r))
|
print("%s:\n%s\n\n" % (e, r))
|
||||||
|
|
||||||
self.assertEqual(errors, [])
|
self.assertEqual(errors, [])
|
||||||
|
|
||||||
|
def test_customize_ks_template(self):
|
||||||
|
"""Test that [customizations.kernel] works correctly"""
|
||||||
|
blueprint_data = """name = "test-kernel"
|
||||||
|
description = "test recipe"
|
||||||
|
version = "0.0.1"
|
||||||
|
|
||||||
|
[customizations.kernel]
|
||||||
|
append="nosmt=force"
|
||||||
|
"""
|
||||||
|
recipe = recipe_from_toml(blueprint_data)
|
||||||
|
self._checkTemplates(recipe)
|
||||||
|
|
||||||
|
def test_customize_list(self):
|
||||||
|
"""Test that [customizations.kernel] works correctly with [[customizations]] error"""
|
||||||
|
blueprint_data = """name = "test-kernel"
|
||||||
|
description = "test recipe"
|
||||||
|
version = "0.0.1"
|
||||||
|
|
||||||
|
[[customizations]]
|
||||||
|
hostname = "testing"
|
||||||
|
|
||||||
|
[customizations.kernel]
|
||||||
|
append="nosmt=force"
|
||||||
|
"""
|
||||||
|
recipe = recipe_from_toml(blueprint_data)
|
||||||
|
self._checkTemplates(recipe)
|
||||||
|
Loading…
Reference in New Issue
Block a user