Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cloudinit/config/cc_snap.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@
snap:
assertions:
00: |
signed_assertion_blob_here
signed_assertion_blob_here
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent @lucasmoura, I'm glad this caught an invalid test config Too! Proof of a job well done.

02: |
signed_assertion_blob_here
signed_assertion_blob_here
commands:
00: snap create-user --sudoer --known <snap-user>@mydomain.com
01: snap install canonical-livepatch
Expand Down
19 changes: 19 additions & 0 deletions tests/unittests/test_handler/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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."""

Expand Down