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:
Brian C. Lane 2019-04-29 15:59:19 -07:00
parent 5b2d894269
commit 41d822f754

View File

@ -227,17 +227,8 @@ class CustomizationsTestCase(unittest.TestCase):
return True
return False
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)
def _checkTemplates(self, recipe):
"""Apply the recipe to all the templates"""
# Test against a kickstart without bootloader
result = customize_ks_template("firewall --enabled\n", recipe)
self.assertTrue(self._checkBootloader(result, "nosmt=force"))
@ -258,3 +249,30 @@ append="nosmt=force"
print("%s:\n%s\n\n" % (e, r))
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)