From 41d822f75435a7037c7afc0711b9caeb45ad0d26 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Mon, 29 Apr 2019 15:59:19 -0700 Subject: [PATCH] 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 --- tests/pylorax/test_compose.py | 40 +++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/tests/pylorax/test_compose.py b/tests/pylorax/test_compose.py index cd4cfd53..95bce6c4 100644 --- a/tests/pylorax/test_compose.py +++ b/tests/pylorax/test_compose.py @@ -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)