diff --git a/cloudinit/config/cc_snap.py b/cloudinit/config/cc_snap.py index 90724b81c04..fbe7787a56a 100644 --- a/cloudinit/config/cc_snap.py +++ b/cloudinit/config/cc_snap.py @@ -61,9 +61,9 @@ snap: assertions: 00: | - signed_assertion_blob_here + signed_assertion_blob_here 02: | - signed_assertion_blob_here + signed_assertion_blob_here commands: 00: snap create-user --sudoer --known @mydomain.com 01: snap install canonical-livepatch diff --git a/tests/unittests/test_handler/test_schema.py b/tests/unittests/test_handler/test_schema.py index 1059fb8b406..ae3838d87c8 100644 --- a/tests/unittests/test_handler/test_schema.py +++ b/tests/unittests/test_handler/test_schema.py @@ -10,6 +10,7 @@ from copy import copy import os +import pytest from io import StringIO from textwrap import dedent from yaml import safe_load @@ -112,6 +113,24 @@ def test_validateconfig_schema_honors_formats(self): str(context_mgr.exception)) +class TestCloudConfigExamples: + + SCHEMA = get_schema() + PARAMS = [ + (schema["id"], example) + for schema in SCHEMA["allOf"] for example in schema["examples"]] + + @pytest.mark.parametrize("schema_id,example", PARAMS) + @skipUnlessJsonSchema() + def test_validateconfig_schema_of_example(self, schema_id, example): + """ For a given example in a config module we test if it is valid + according to the unified schema of all config modules + """ + config_load = safe_load(example) + validate_cloudconfig_schema( + config_load, TestCloudConfigExamples.SCHEMA, strict=True) + + class ValidateCloudConfigFileTest(CiTestCase): """Tests for validate_cloudconfig_file."""